Search function now works flawlessly