add logic to switch views in controller