refactoring java files to reflect MVC