added to Mac, some minor modifications