added mac osx implementation