modified for MacOS