Reinstate outer function wrapper. Correct annotations to handle more
warnings.