add statistics calculation class and some updates