modified GA code