Re-added shape grouping
Fixes #423