Better method for outputing x and y in ascending x
fixed link