Adding method to topologically order a reference to try to group
consecutive blocks