Adaptation of code for Windows