refactored to align with MVC