Implemented FSM behaviour