added another loop to genetic algorithm