Basic threshold detection working