modified app_controller