started refactoring for MVC