Merge "Refactor refining_search_sad code"