stat functions definitions