allow API callers to provide a callback