Some minor fixes and improvements: use logger, reformat code...