working (not perfect!) search