Refactored MVC classes to make unit testing  possible