Refactoring NavBarController.js