Counting bug fix.
New statistical function.
Produce events in multiple threads.