moved implementation of worker threads to the header files