Refactored state transitioning to its own model