Print function updated