Some code cleanup. Change log format.