Stats and refactor