switching if else statment for pages select location logic and comments added
merging with master