updated to use genetic algorithm