added listener for gradient calculations