Move state object into a separate file