Added new view handling when switching from one view to another.