add statistics function