Removed unused function search_best_mode()