Added state machine functions, moved all gameplay into seperate state. Added label JS