Refactor rest of test_selector.