State Machine implementation finished