Refactoring `data.select()` to be O(n)