Smarter page handling