moved compile_selector elsewhere