Refactoring code, mainly locomotion_bends.py