On the road to re-implementation of sample intersection
Minor refactoring
Possible (and necessary) re-implementation of keygen for intersection