Refactor code.
Support Linux like OS.