clean up: removed temp variables.  moved new attribute assignment out of case statement