Modified Search code