fixed jerky motion
restructured and fixed errors. state transition errors to be corrected
done restructuring. stack error with historyStates