tidyied up some group-assignment code