Refactored into MVC