architecture refactoring to MVC model