add detection code