Improving stats code and removing hard-coded values