Added functionality to switch views.