Introducing view models, cleanup of controller and view logic, and bug fixes