Major refactoring and cleanup on the controller/view handling.