Refactored resolvePage into more multiple functions. Added normalize.