Refactoring models and controllers. WIP