First step in refactoring the code using MVC design pattern