added windows compatible code