Cursory refactoring of code to adhere to MVC