Working version of detector