Implemented linear interpolation function