Add statistics function