updated to support a genetic algorithm.