done coding fsm, ready for testing