Added logging and tests.
Added missing test file.