Code refactoring in preparation of adding sorting to new page types