Modified GA code