added search/apply functionality to rule (half the way)