refactors for more MVC architecture