re-import to Mac, modify some code