added mating function