A comment explaining numberOfGroups (and therefore also whiteGroupStart/BLACK_GROUP_START) would be nice before the previous 2 lines.