Is this `sort` efficient? Does it have to be done within the loop?