Refactored

When last group is 2 or less its get assigned to first group