Implemented search function. Requires further testing and refinement of
algorithm