F/rewrite groupset

Added groupset rewrite object and added tests for rewrite functionality.