Refactored to MVC