implement recursive extraction.