Code cleanup
Check argument
Added toggle switch to debug mode
Cleanup tests
Add tests from master
Merge pull request #39 from fluxroot/2.2.x-cleanup

Code cleanup