added stats code