Fixed a couple things

The code didn't quite work when the group size was evenly divisible by the group. I think I fixed it.