refactor stat