Replaced calls to Unix programs for better cross-platform compatibility.