Refactor table extraction.