cleaning up util functions; passing PrintStream into compare- functions