Cleaned up error handlers a bit