updated populate_page_with to check visibility