Make the error handling a little better