Fix nesting of internal functions and reduce scope of interpolate