refactor stat parser