modified for Windows