Refactor extrapolation mode handling