Refactoring the Application Controller