Ported atomic code to OSX and clean up the header files