refactoring code to MVC pattern -- wip
refactoring code to MVC pattern -- wip