Improve code stringification
This makes code stringification deterministic, makes the initial phase clear in the stringified code, and renames STAGE in the output to PHASE.
This makes code stringification deterministic, makes the initial phase clear in the stringified code, and renames STAGE in the output to PHASE.