correctly order datapoints