refactored workers and added tests