added logic to page template