adapted for osx