expand stringify(), also unify prefix-writing impl