updated to work with seperated pages for tabs