changed the way selection functions are defined