Fixed logging.
+ Other small changes.