using generators for selection functions