Refactoring: refactor application controller.