Solving the working thread problem