Remove global system variable and add support for Windows.