Search function added, but not working properly