Pass 3 (Main rewrite done.)