Started writing tests.
Fixed unicode issue when writing file.