Improved processing output on errors. Added test for error output.
Strong assumptions were made. If anyone has an idea of how to weaken them, you're welcome!