Initial framework of state machine