Quick refactor of linearInterpolation.