Refactored handling of local group size so that it is easier to modify.