major refactoring to mvc. preparing for webui. broke all the tests