More reliable stringify with a custom format. Cleanup.