Refactored itm print code