Changes to get this to compile for osx mountain lion (darwin 12.3.0).  Running was not tested yet.