Refactored from route to state