Added the sorting of pages