Enabling grouping of pages, pagination by groups and other fixes