Recursive extraction of subtypes