Update statistics logic.