- More changes to ApplicationController

- Refactored more code into the application controller.