Cleaned up OSX code