refactoring page template