added tmin and tmax parameters, and tested, it ran well