Counting statistics

Work in progress.

New counting statistics module.