Updated code for Windows