Refactor the relation FSM into seperate modules, and fixed some bugs in the IK state - still some bugs remaining.