Refactoring pages retrieval
Improved complexity