Improve error handling; use Paul's new calls