Added worker class to support multithreading