updated stats code