Moved more code to view.