Implemented getTotalDifferential, except for one case. The function will move to a different place later.