Character rig not importing properly-Geometry not referenced and no animation

I made a rig for my Panda and I was pretty happy with it. I created a bunch of custom attributes using pivot groups and such, it gave me some really nice control over the legs. It let keep the feet plated firmly on the ground, whatever the orientation of the ankles was. Problem is when I imported this character+skeleton into unreal, I got loads of errors and it was totally unusable. Ive looked into why and found that the rig maybe too complex for unreal

I redid the skeleton, focusing on a more simple set up and was able to import him into engine. I got some wierd error message but it still worked as intended. This new skeleton has the same joint structure as the previous one, I have just simplified the set up to use just IK handles. This has had a bad effect on the posses I he can assume, the worst is the feet. The ankle IK is twisting around itself and the foot will not stay on the ground unless it is pointing forward, this of course looks quite terrible.

I tried to upload my maya file to make things easier but it was too big and I couldnt upload a zip either.

Obviously the first skeleton is the best and I would love to be able to use that. If I can’t, does anyone have any thoughts on how to go about rigging this guy so he has all the controls needed and works in unreal?

Thanks