Refactorings, and a start on Windows