added code to get statistics