small refactoring of applicationcontroller