Added a lot of unit tests and started refactoring the interface for logging