1) Fixed issue with test classes auto loading
2) Added tests for most of classes
3) Fixed discovered issues in the code