third attempt at sort