added total statistic ouptut to console and file