Working version from mac