Stats record is supposed to be per-index, but currently it is a global variable; presumably we should change this