added func for tman and gradient