tests of gates are OK, TODO: test and make work the membership funcitons