modified Bryans program1 to compile on linux. tried to make it stay working on osx too