state machine is done, but needs testing