Modify Reiswich's code for use in Unix