Migrate towards MVVM

This is mostly new territory for me, so I'm taking it slowly. Feedback welcome.