Adding threads support