Mainpager refactoring