Made some fixes to how data is output, including an error object.
Merge pull request #1 from miketoth/fixes

Made some fixes to how data is output, including an error object.