I think I'm going to change this around to use switch/case like the code for the Jacobian.