Refactoring controllers
Adding unit tests for controllers