added gengradient and genline