Refactor code completely to use MVC architecture

That means lots of broken features but oh well.. we'll fix them.