Clean up special detection code