Fixed some bugs and added MacOSX versions of some things.