Added support for statistic module (rebased)

#378 rebased