made Gen and Transfer use TwoElementSet
cleaned up code