Cleanup logging for state machine events.
Cleanup + add comments for StateMachine class.