added logic for page type