Clean up search code