refactor stats