cosmetic changes + add createDirs option
update tests, fix code
fix tests