Tweaked the writer for better external iteration.