Created the quizService.js functionality. This is optimizing my code and making it cleaner by declaring rootScope variables in the service, and doing all the  calls in the service rather than the controller.