make minimal platform check for darwin compatibility
remove duplicate code
Merge pull request #1 from plitzenberger/master

make minimal platform check for darwin compatibility