generalize code to accept Gen instead of demanding an Arbitrary