search groups logic implemented