modified for isolating windows specific code.
isolated windows logic.