sort links so that they fit into two lines