moving the state machine to the sub classes