Move page handling into frame.py