Updated and moved statistics functions to model.