Use ltrim for diff output, rather than trim
Fix trim error
Changes to behavior on error
Changes to error handling