The extrapolation code for case 1 is made more readable and compact. Needs testing.