Add in support for generated structures

try this one
You might want to pull this condition out of the inner loop and store its result into a bool variable, to avoid string comparison in a tight loop.