Tiered select

I made two commits, one for the feature and one for the test (which includes a bunch of pasted data), so probably easier to review commit by commit.