Improved the interpolation routine