Refactored main.js to use a service only with the model api. Fixed all jshint errors and warnings