write GA code