Refactoring the way pages are generate