detection algo