Adapted for Mac.