mvc-like refactoring