GA code implementation