combined interpolation code (under double #### lines)