Beginnings of mac safe-ness

Added detection of MacOS and verified some of the functionality (some
functions still don't work... getting there).