add threads support