Added Logger support, rewrote most of the module to support unit testing. (Bad thing is I did not write unit tests...)