fix gderiv function kind-of, needs more work in order to look more fluid
dint needs more work as well