Cleaned up code in MainController.js