flattenRecursively