Refactored searching and logging logic into include files
Pulled each search into its own function