restructed stuff to MVC