Mostly just cleanup; some w32 compat