add ordering to relations