added partially working code to refine search results