Add a rank to the lines so that we can sort by arrival