Implemented work detection in generator.