Changed interface to return errors as an out param.