starting to work on state machine for backend