Updated error messages and optimized when to add error message to result.