better approach in MainController