fixing #26
added documentation
fix braces
added unit tests for error reporting
cast debugmode to boolean
new line
Merge pull request #29 from Rovak/fix/errorhandling

fixes #26