modified GA code a bit