Proper MAM-compatible archiving, and approximately a quantizillion bugfixes