Sped things up a bit. Only computing sorted once.