Made improvements to crossover function