Mostly switched to MVVM

Cleaned up a lot of code by switching to MVVM architecture.