Refactored snippets list into common function
Refactored search to use snippetList