added printing to file