........S. [ZBX-8873] simplified code in generate_events(), fixed comments