added statistics at the end