Added capability to take derivatives