Add maxiter argument to top-level func.