Improved stats, wholetree, and header handling