Keep selections sorted, performance improvements