making the integration only work off the first derivative