working on detection threading scheme