Improved complex text parsing