detection code