get rid of confusing state machine