Implement several statistics functions.