F/rewrite groupset

Added groupset rewrite object and added tests for rewrite functionality.
if there's an assertion, why the extra check?