Start of change to make the output file contains two sets of waypoints, rather than two output files.
Changed order of time and distance parameters.