Standardize error-handling somewhat