move state to its own file