refactor windows platform code