refactors into rudimentary MVC