Remove Unpainted Paths: rewrite to support (nested) groups