rewrote all thread calls to use same function