windows fixes and pedantic cleanup