WIP state machine

fixed some syntax errors