Fixes and support for Windows