Some refactoring for Windows