More refactoring for defining state machine with meaningful class names and
minor cleanups