init function moved from controller to app