Merge back in Windows changes

This is my own PR for merging back in the Windows work.