working on the flattenging script, almost got it