Windows installation fixes, small refactoring