cleanup and refinements for GenerateAttibute