Large rewrite + extended extrapolation code