Refactor into Model, State, Components and Controller.