Fix output directory. Complete unit tests.