added thread manager; need unit tests