Cleanup state machine.cpp