added sorting of pages