Added code to check which view will be displayed