added finalised shared GA code