log update and code cleaning