pre- MVC refactoring