updated the way page visibility is managed