osx pilfering from mathias