Made changes to the error handling. Hopefully it uses the `error` callback more consistently now.