Added better matching for parent headings