Code clean and printing optimizations