switched to more simplistic thread management