search by name and id functional - cleaned code