added statistics function