some code cleaning for printing