change from printing to logging