Added functionality to view switching buttons