Changed logging. Added a couple of Unit Tests