working through stats code