some refactoring of extrapolation