polish and log code