Removing some of the javascript logic from the views.