comments added to explain geneticoptimize method