Changed logfile to XYR, and also added moved printing to use the multiple passes