Bug fixes for the text extraction
Various bug fixes in merge and extract functions, but there are still some logic bugs because the extraction isn't getting the right text values back. Need to continue debugging the extract function.