changed debugging to print to stdout