MacGap rewrite