revisited/cleaned up purity-gen.nb