cleaned up applClassNamesRecursively