Merge official changes into fork

Changes appear to mainly be code cleanup.