finished unix code
TODO: windows code