multiple style fixes and also introduce log_debug