Finish calculating derivatives