separated search functionality to its own file