Adding change page logic