tweaking search function in js