Revert "Nested loop works in sorting, support small N"

This reverts commit 9dcd219bd13a10ba101c5af278308b539bd5070f.