Now genetic algorithm seems to work