Better handling of page resize