Improved Gait Manager

See comments in the code.