working windows build

source code changes for
1) successful windows compilation
2) working windows version