moving on to calculating gradients