- added comments plus minor refactoring
- minor fixes for unittests