threads implementation w-i-p