Refactored state into separate file