Restructured to an MVC framework