Massive rearchitecture

Move stuff out of view code and into viewmodels.