Mocap walking loop cleanup

I’m new to Blender animation. I mainly work with unreal and recently got into motion capture. I’m trying to clean up one of my walking captures but cant seem to get a glitch out of the walking loop at the beginning and end. I’ve been messing with it for several days but cant get it just right. Any tips on how to make this loop more smooth so that it doesn’t glitch every time the loop resets?

This is probably a stupid question but are there any tips on how to get the feet to recognize they’re walking on an actual floor? I saw a video last night on youtube from Royal Skies where he created a custom driver that would tell the feet there is a floor and how to bend as it comes in contact with it. The problem is he’s using a custom skeletal system and im using the Unreal Engine skeletal system.

Thanks in advance for your help and any tips or tricks you might have.

I tried to upload a short clip of the walking animation loop but im a new user and it wont let me.

NLA / Action Editor
http://blender-3d.338.s1.nabble.com/NLA-Editor-tp1410p1562.html

Retarget to a custom rig
http://blender-3d.338.s1.nabble.com/How-to-Rig-a-Character-Rigify-tp452p1952.html

Walk Cycle
http://blender-3d.338.s1.nabble.com/Walk-Cycles-and-Markers-tp129p710.html

Rigs (UE4/Unity/Godot)
http://blender-3d.338.s1.nabble.com/Game-ready-Rigs-UE4-Unity-Godot-Blender-2-8-2-9-tp1347.html