Adding unit tests. Changes to logging.