Multi thread implementation