tested and works on mac osx