add gradient functions 'from' and 'to'