Merge pull request #2 from qqalexqq/master

Cleanup and error messages.
Cleanup
Cleanup
Improved debug output