Use remaining space if group percentage greater than remaining space.

Loop syntax improvements.