restructing to MVC