Added in fixes to make the code more Windows-friendly