state machine works :)