Moved state transitions into state class