added logic to only show page when done loading