Zza: refactoring for joint SQL/Mongo version (progress)