started with a simple state machine