Modified to be able to compile on MacOSX
Modified to be able to compile on Mac OSX