refactored to use new error-prone API