add statistics code