making the grad work properly

with the ability to change the slope calculation also