made some changes so that mac can use the script too