[erdb4:local/src/archiveopteryx] root# git diff -R -u instrumentation hung_patch_from_arnt
diff --git b/hung_patch_from_arnt/2017-07-13.patch a/hung_patch_from_arnt/2017-07-13.patch
deleted file mode 100644
index 7c1a047..0000000
--- b/hung_patch_from_arnt/2017-07-13.patch
+++ /dev/null
@@ -1,11 +0,0 @@
-diff --git a/server/tlsthread.cpp b/server/tlsthread.cpp
-index e25ed6b..8e05547 100644
---- a/server/tlsthread.cpp
-+++ b/server/tlsthread.cpp
-@@ -352,7 +352,7 @@ void TlsThread::start()
-               tv.tv_usec = 0;
-           }
--            int n = select( maxfd+1, &r, &w, 0, &tv );
-+            int n = finish ? 0 : select( maxfd+1, &r, &w, 0, &tv );
-           if ( n < 0 && errno != EINTR )
-               finish = true;
diff --git b/hung_patch_from_arnt/Re_ Frequently crashing_hanging on FreeBSD 11.eml a/hung_patch_from_arnt/Re_ Frequently crashing_hanging on FreeBSD 11.eml
deleted file mode 100644
index 253a15b..0000000
--- b/hung_patch_from_arnt/Re_ Frequently crashing_hanging on FreeBSD 11.eml    
+++ /dev/null
@@ -1,199 +0,0 @@
-From Mykel@mWare.ca Thu Jul 13 14:45:53 2017
-Return-Path: <owner-users@aox.org>
-Received: from 91.216.35.72 (HELO mx4.lrau.net) by imap.lrau.net
- (Archiveopteryx 3.2.0) with lmtps id 1499949953-73807-73806/4/228 for
- Axel.Rau@Chaos1.DE; Thu, 13 Jul 2017 12:45:53 +0000
-Received: from strange.aox.org ([80.244.248.170])
-       by mx4.lrau.net with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256)
-       (Exim 4.89 (FreeBSD))
-       (envelope-from <owner-users@aox.org>)
-       id 1dVdVB-000Pcm-7i
-       for Axel.Rau@Chaos1.DE; Thu, 13 Jul 2017 12:45:53 +0000
-Received: by strange.aox.org (Postfix, from userid 65534)
-       id 7CFE2FA015A; Thu, 13 Jul 2017 12:45:52 +0000 (UTC)
-X-Greylist: delayed 73 seconds by postgrey-1.34 at strange.aox.org; Thu, 13 Jul 2017 12:45:51 UTC
-Received: from Vice.ServerNorth.net (vice.ServerNorth.net [209.44.123.194])
-       by strange.aox.org (Postfix) with ESMTP id C02BDFA005F
-       for <users@aox.org>; Thu, 13 Jul 2017 12:45:51 +0000 (UTC)
-Received: from mail.servernorth.net (localhost [127.0.0.1])
-       by Vice.ServerNorth.net (Postfix) with ESMTP id 521F856848
-       for <users@aox.org>; Thu, 13 Jul 2017 08:44:36 -0400 (EDT)
-Received: from mykel@mWare.ca by mail.servernorth.net (Archiveopteryx
- 3.1.4) with esmtpsa id 1499949874-89693-89691/9/4; Thu, 13 Jul 2017
- 08:44:34 -0400
-Subject: Re: Frequently crashing/hanging on FreeBSD 11
-To: users@aox.org
-References: <ABD7B8B9-9390-4069-8D3E-2FBA7E577B1B@Chaos1.DE>
-From: mykel@mWare.ca
-Message-Id: <fe05090a-5307-f1ee-7c77-68fd4326be9d@mware.ca>
-Date: Thu, 13 Jul 2017 08:44:33 -0400
-User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
- Gecko/20100101 Thunderbird/52.2.1
-Mime-Version: 1.0
-In-Reply-To: <ABD7B8B9-9390-4069-8D3E-2FBA7E577B1B@Chaos1.DE>
-Content-Type: text/plain; charset=utf-8; format=flowed
-Content-Transfer-Encoding: quoted-printable
-Content-Language: en-CA
-List-Id: <users.aox.org>
-List-Post: <mailto:users@aox.org>
-List-Help: <mailto:info@aox.org>
-List-Owner: <mailto:info@aox.org
-List-Unsubscribe: <mailto:users-request@aox.org?subject=unsubscribe>
-X-Erdb: RVHL/true/1, RDNS/true/0.1, RKMR/false/0, RRAT/0/-0/-2, RGRL/state_gl_opened/-1, TOT/1.1/-0.99/A/{3629170/3}
-
-I'm don't know what to look for, but I have a couple machines that need=20
-aox restarts every day or two. FreeBSD 11 and ... uh... 7.
-
-
-On 2017/07/13 05:32, Axel Rau wrote:
-> Hungs show all threads in select (TlsThread).
-> We failed to get a backtrace via lldb on crash.
->
-> This happens with both release 3.2.0 and recent PGP sig patch from =
-github.
->
-> The server is running in a FreeBSD jail in secure mode.
-> Client connection is via TLS only.
->
-> Anybody seeing similar problems on FreeBSD?
->
-> Axel
-> ---
-> PGP-Key:29E99DD6  =E2=98=80  computing @ chaos claudius
->
-
-
-From arnt@gulbrandsen.priv.no Thu Jul 13 15:02:22 2017
-Return-Path: <owner-users@aox.org>
-Received: from 91.216.35.72 (HELO mx4.lrau.net) by imap.lrau.net
- (Archiveopteryx 3.2.0) with lmtps id 1499950942-73807-73806/4/249 for
- Axel.Rau@Chaos1.DE; Thu, 13 Jul 2017 13:02:22 +0000
-Received: from strange.aox.org ([80.244.248.170])
-       by mx4.lrau.net with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256)
-       (Exim 4.89 (FreeBSD))
-       (envelope-from <owner-users@aox.org>)
-       id 1dVdl7-00004b-8h
-       for Axel.Rau@Chaos1.DE; Thu, 13 Jul 2017 13:02:22 +0000
-Received: by strange.aox.org (Postfix, from userid 65534)
-       id 95BBAFA015B; Thu, 13 Jul 2017 13:02:20 +0000 (UTC)
-Received: from fri.gulbrandsen.priv.no (localhost [127.0.0.1])
-       by strange.aox.org (Postfix) with ESMTP id 428ECFA005F;
-       Thu, 13 Jul 2017 13:02:20 +0000 (UTC)
-Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gulbrandsen.priv.no;
-       s=mail; t=1499950940;
-       bh=nTaDQIoXcESVHklhuZsufLFx/QiGkrhE3VnLRKfiB+A=;
-       h=From:To:Subject:Date:In-Reply-To:References:From;
-       b=dHNLAQUCDOTq9tOUtd7brnJ2H072Hm95PTumN9tcmG3cDk2zvtJDXntgn4I4elicw
-        b0S0LeqeISub3gG2adeHAKRHnplNCpcynZyJ0r2i9fmBdC5rGQzl3s7YIcQalPHjz8
-        cp5JUhydd8wu0uMvpAhoW/kxJ4bY+NXcFCzOR/Bo=
-Received: from arnt@gulbrandsen.priv.no by fri.gulbrandsen.priv.no
- (Archiveopteryx 3.2.0) with esmtpsa id 1499950939-20675-1947/11/101;
- Thu, 13 Jul 2017 13:02:19 +0000
-From: Arnt Gulbrandsen <arnt@gulbrandsen.priv.no>
-To: users@aox.org
-Subject: Re: Frequently crashing/hanging on FreeBSD 11
-Date: Thu, 13 Jul 2017 14:02:18 +0100
-User-Agent: Trojita/v0.5-9-g8961725; Qt/4.8.6; X11; Linux; Devuan GNU/Linux 1.0 (jessie)
-Mime-Version: 1.0
-Message-Id: <6135e4ca-7b08-4840-a2bf-49208c37ce62@gulbrandsen.priv.no>
-In-Reply-To: <fe05090a-5307-f1ee-7c77-68fd4326be9d@mware.ca>
-References: <ABD7B8B9-9390-4069-8D3E-2FBA7E577B1B@Chaos1.DE>
- <fe05090a-5307-f1ee-7c77-68fd4326be9d@mware.ca>
-Content-Type: text/plain; charset=utf-8; format=flowed
-Content-Transfer-Encoding: quoted-printable
-List-Id: <users.aox.org>
-List-Post: <mailto:users@aox.org>
-List-Help: <mailto:info@aox.org>
-List-Owner: <mailto:info@aox.org
-List-Unsubscribe: <mailto:users-request@aox.org?subject=unsubscribe>
-X-Erdb: RVHL/true/1, RDNS/true/0.1, RKMR/false/0, RRAT/0/-0/-2, RGRL/state_gl_opened/-1, TOT/1.1/-0.99/A/{3629204/3}
-
-Axel, can you try this? Seems like a %#$%$ obvious bug.
-
-Arnt
-
-diff --git a/server/tlsthread.cpp b/server/tlsthread.cpp
-index e25ed6b..8e05547 100644
-=2D-- a/server/tlsthread.cpp
-+++ b/server/tlsthread.cpp
-@@ -352,7 +352,7 @@ void TlsThread::start()
-                 tv.tv_usec =3D 0;
-             }
-=20
--            int n =3D select( maxfd+1, &r, &w, 0, &tv );
-+            int n =3D finish ? 0 : select( maxfd+1, &r, &w, 0, &tv );
-             if ( n < 0 && errno !=3D EINTR )
-                 finish =3D true;
-
-
-From Axel.Rau@chaos1.de Thu Jul 13 11:34:10 2017
-Return-Path: <owner-users@aox.org>
-Received: from 91.216.35.72 (HELO mx4.lrau.net) by imap.lrau.net
- (Archiveopteryx 3.2.0) with lmtps id 1499938450-73807-73806/4/50 for
- Axel.Rau@Chaos1.DE; Thu, 13 Jul 2017 09:34:10 +0000
-Received: from strange.aox.org ([2001:4d88:100c::1])
-       by mx4.lrau.net with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256)
-       (Exim 4.89 (FreeBSD))
-       (envelope-from <owner-users@aox.org>)
-       id 1dVaVe-000KhE-95
-       for Axel.Rau@Chaos1.DE; Thu, 13 Jul 2017 09:34:10 +0000
-Received: by strange.aox.org (Postfix, from userid 65534)
-       id 6E558FA00DA; Thu, 13 Jul 2017 09:34:09 +0000 (UTC)
-X-Greylist: delayed 86 seconds by postgrey-1.34 at strange.aox.org; Thu, 13 Jul 2017 09:34:09 UTC
-Authentication-Results: strange.aox.org; dkim=pass
-       reason="2048-bit key; insecure key"
-       header.d=chaos1.de header.i=@chaos1.de header.b=TQHovF9n;
-       dkim-adsp=pass; dkim-atps=neutral
-Received: from mailout4.lrau.net (mailout4.lrau.net [IPv6:2a05:bec0:26:2::73])
-       by strange.aox.org (Postfix) with ESMTPS id 09325FA005F
-       for <users@aox.org>; Thu, 13 Jul 2017 09:34:07 +0000 (UTC)
-Dkim-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=chaos1.de;
-        s=email1; h=To:Message-Id:Subject:Date:Mime-Version:
-       Content-Transfer-Encoding:Content-Type:From:Sender:Reply-To:Cc:Content-ID:
-       Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
-       :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
-       List-Subscribe:List-Post:List-Owner:List-Archive;
-       bh=YRJy0HTeLEjNTCKb6MwNoEID0egzctxMJGjXXZd93kE=; b=TQHovF9njD2nyLKF0x1sZvTfR6
-       fBcJDhfb/0RZaQ8xxQKw7Yyo3thyd/yRZX5N4w8dQt3Yqp7ysWWhsH/xGEHvo3VlHpbdZsZvxm4P/
-       au9CECmPDslt6tau+9xcrBitDbzmYpk4rHI28uHeCRBPAAJyOmShi0d672ejVnq54Zu7pyU7Rp/qZ
-       irjhX+WuvcyolOh1rCG4ByuoSRNSWK/IFYctkTr5V/eO3lpMWEKKL2hpqH171ykY4H15JNNXfGvx9
-       OwQN5NPGxQPqMR/uL9c/pJNqIrQrLOiR2hCWuei2ptwp8l4NtL8p0nyHQgiGyk1btazdg93vLNq4Q
-       DxUWYNPg==;
-Received: from [91.216.35.74] (helo=imap.lrau.net)
-       by mailout4.lrau.net with esmtp (Exim 4.89 (FreeBSD))
-       (envelope-from <Axel.Rau@Chaos1.DE>)
-       id 1dVaUE-000Ke0-Fx; Thu, 13 Jul 2017 09:32:42 +0000
-Received: from Axel.Rau@Chaos1.DE by imap.lrau.net (Archiveopteryx
- 3.2.0) with esmtpsa id 1499938360-73807-73806/6/1; Thu, 13 Jul 2017
- 09:32:40 +0000
-From: Axel Rau <Axel.Rau@Chaos1.DE>
-Content-Type: text/plain; charset=utf-8
-Content-Transfer-Encoding: quoted-printable
-Mime-Version: 1.0
-Date: Thu, 13 Jul 2017 11:32:39 +0200
-Subject: Frequently crashing/hanging on FreeBSD 11
-Message-Id: <ABD7B8B9-9390-4069-8D3E-2FBA7E577B1B@Chaos1.DE>
-To: users@aox.org
-X-Mailer: Apple Mail (2.3273)
-List-Id: <users.aox.org>
-List-Post: <mailto:users@aox.org>
-List-Help: <mailto:info@aox.org>
-List-Owner: <mailto:info@aox.org
-List-Unsubscribe: <mailto:users-request@aox.org?subject=unsubscribe>
-X-Erdb: RVHL/true/1, RDNS/true/0.1, RKMR/false/0, RRAT/0/-0/-2, RGRL/state_gl_opened/-1, TOT/1.1/-0.99/A/{3628878/3}
-
-Hungs show all threads in select (TlsThread).
-We failed to get a backtrace via lldb on crash.
-
-This happens with both release 3.2.0 and recent PGP sig patch from =
-github.
-
-The server is running in a FreeBSD jail in secure mode.
-Client connection is via TLS only.
-
-Anybody seeing similar problems on FreeBSD?
-
-Axel
-=2D--
-PGP-Key:29E99DD6  =E2=98=80  computing @ chaos claudius
-
diff --git b/hung_patch_from_arnt/aox/.git/config a/instrumentation/aox/.git/config
index d6aafc3..8606904 100644
--- b/hung_patch_from_arnt/aox/.git/config
+++ a/instrumentation/aox/.git/config
@@ -4,7 +4,7 @@
        bare = false
        logallrefupdates = true
 [remote "origin"]
-       url = git@github.com:aox/aox
+       url = https://github.com/mc3/aox
        fetch = +refs/heads/*:refs/remotes/origin/*
 [branch "master"]
        remote = origin
diff --git b/hung_patch_from_arnt/aox/.git/index a/instrumentation/aox/.git/index
index f42edc3..2ce4625 100644
Binary files b/hung_patch_from_arnt/aox/.git/index and a/instrumentation/aox/.git/index differ
diff --git b/hung_patch_from_arnt/aox/.git/logs/HEAD a/instrumentation/aox/.git/logs/HEAD
index db9a9f9..b0701af 100644
--- b/hung_patch_from_arnt/aox/.git/logs/HEAD
+++ a/instrumentation/aox/.git/logs/HEAD
@@ -1 +1 @@
-0000000000000000000000000000000000000000 429c9404f9bb7ae1045093ceb9a3450d07fcefa7 Axel Rau <axel.rau@chaos1.de> 1499975747 +0000       clone: from git@github.com:aox/aox
+0000000000000000000000000000000000000000 b48331f7f63e52a5f2c0240595ca5724f82e0944 Axel Rau <axel.rau@chaos1.de> 1486486765 +0000       clone: from https://github.com/mc3/aox
diff --git b/hung_patch_from_arnt/aox/.git/logs/refs/heads/master a/instrumentation/aox/.git/logs/refs/heads/master
index db9a9f9..b0701af 100644
--- b/hung_patch_from_arnt/aox/.git/logs/refs/heads/master
+++ a/instrumentation/aox/.git/logs/refs/heads/master
@@ -1 +1 @@
-0000000000000000000000000000000000000000 429c9404f9bb7ae1045093ceb9a3450d07fcefa7 Axel Rau <axel.rau@chaos1.de> 1499975747 +0000       clone: from git@github.com:aox/aox
+0000000000000000000000000000000000000000 b48331f7f63e52a5f2c0240595ca5724f82e0944 Axel Rau <axel.rau@chaos1.de> 1486486765 +0000       clone: from https://github.com/mc3/aox
diff --git b/hung_patch_from_arnt/aox/.git/logs/refs/remotes/origin/HEAD a/instrumentation/aox/.git/logs/refs/remotes/origin/HEAD
index db9a9f9..b0701af 100644
--- b/hung_patch_from_arnt/aox/.git/logs/refs/remotes/origin/HEAD
+++ a/instrumentation/aox/.git/logs/refs/remotes/origin/HEAD
@@ -1 +1 @@
-0000000000000000000000000000000000000000 429c9404f9bb7ae1045093ceb9a3450d07fcefa7 Axel Rau <axel.rau@chaos1.de> 1499975747 +0000       clone: from git@github.com:aox/aox
+0000000000000000000000000000000000000000 b48331f7f63e52a5f2c0240595ca5724f82e0944 Axel Rau <axel.rau@chaos1.de> 1486486765 +0000       clone: from https://github.com/mc3/aox
diff --git b/hung_patch_from_arnt/aox/.git/objects/pack/pack-601bef99dc7cc346dc016454e849b52bcbf68a6f.idx a/instrumentation/aox/.git/objects/pack/pack-49c39f9870f98613c18eca0987314b95bb0ae2ba.idx
similarity index 70%
rename from hung_patch_from_arnt/aox/.git/objects/pack/pack-601bef99dc7cc346dc016454e849b52bcbf68a6f.idx
rename to instrumentation/aox/.git/objects/pack/pack-49c39f9870f98613c18eca0987314b95bb0ae2ba.idx
index 12013e6..0d87a1b 100644
Binary files b/hung_patch_from_arnt/aox/.git/objects/pack/pack-601bef99dc7cc346dc016454e849b52bcbf68a6f.idx and a/instrumentation/aox/.git/objects/pack/pack-49c39f9870f98613c18eca0987314b95bb0ae2ba.idx differ
diff --git b/hung_patch_from_arnt/aox/.git/objects/pack/pack-601bef99dc7cc346dc016454e849b52bcbf68a6f.pack a/instrumentation/aox/.git/objects/pack/pack-49c39f9870f98613c18eca0987314b95bb0ae2ba.pack
similarity index 97%
rename from hung_patch_from_arnt/aox/.git/objects/pack/pack-601bef99dc7cc346dc016454e849b52bcbf68a6f.pack
rename to instrumentation/aox/.git/objects/pack/pack-49c39f9870f98613c18eca0987314b95bb0ae2ba.pack
index 0f7646f..e0c69a5 100644
Binary files b/hung_patch_from_arnt/aox/.git/objects/pack/pack-601bef99dc7cc346dc016454e849b52bcbf68a6f.pack and a/instrumentation/aox/.git/objects/pack/pack-49c39f9870f98613c18eca0987314b95bb0ae2ba.pack differ
diff --git b/hung_patch_from_arnt/aox/.git/packed-refs a/instrumentation/aox/.git/packed-refs
index bea595f..38f3516 100644
--- b/hung_patch_from_arnt/aox/.git/packed-refs
+++ a/instrumentation/aox/.git/packed-refs
@@ -1,5 +1,6 @@
 # pack-refs with: peeled fully-peeled 
-429c9404f9bb7ae1045093ceb9a3450d07fcefa7 refs/remotes/origin/master
+b48331f7f63e52a5f2c0240595ca5724f82e0944 refs/remotes/origin/master
+848a52933ede3588324ffc9fa87291887734a68b refs/remotes/origin/pgp_sig_ml_fix
 ef1e2b935840ec35f338af64ae1d75053677bf06 refs/tags/v2.08
 ^7af7cbfb4a39a60edb480af8eb563544fa166096
 f010edf5c86f26ccd5b70afa773390a95541efd8 refs/tags/v2.09
diff --git b/hung_patch_from_arnt/aox/.git/refs/heads/master a/instrumentation/aox/.git/refs/heads/master
index ea0abdf..a42fbbb 100644
--- b/hung_patch_from_arnt/aox/.git/refs/heads/master
+++ a/instrumentation/aox/.git/refs/heads/master
@@ -1 +1 @@
-429c9404f9bb7ae1045093ceb9a3450d07fcefa7
+b48331f7f63e52a5f2c0240595ca5724f82e0944
diff --git b/hung_patch_from_arnt/aox/Jamrules a/instrumentation/aox/Jamrules
index 91fabe8..aa06125 100644
--- b/hung_patch_from_arnt/aox/Jamrules
+++ a/instrumentation/aox/Jamrules
@@ -13,6 +13,7 @@ if $(OPTIM) = "-O" {
     OPTIM = "-O3" ;
 }
 OPTIM ?= ;
+#OPTIM = "-O3";
 RANLIB = ;
 
 USE_X86_ASM = ;
diff --git b/hung_patch_from_arnt/aox/Jamsettings a/instrumentation/aox/Jamsettings
index 6ad07ee..0d67c6d 100644
--- b/hung_patch_from_arnt/aox/Jamsettings
+++ a/instrumentation/aox/Jamsettings
@@ -71,7 +71,8 @@ AOXGROUP ?= aox ;
 
 # How to compile
 
-C++FLAGS = -g -funsigned-char ;
+C++FLAGS = -g -funsigned-char -O3 ;
+#C++FLAGS = -g -funsigned-char ;
 LINKFLAGS = -g ;
 
 # Mode for installed binaries
diff --git b/hung_patch_from_arnt/aox/abnf/abnfparser.cpp a/instrumentation/aox/abnf/abnfparser.cpp
index 0900b26..40b1a15 100644
--- b/hung_patch_from_arnt/aox/abnf/abnfparser.cpp
+++ a/instrumentation/aox/abnf/abnfparser.cpp
@@ -168,8 +168,7 @@ bool AbnfParser::present( const EString & s )
 void AbnfParser::require( const EString & s )
 {
     if ( !present( s ) )
-        setError( "Expected: " + s.quoted() + " at " + fn( d->at ) +
-                  ", got: " + following() );
+        setError( "Expected: " + s.quoted() + ", got: " + following() );
 }
 
 
diff --git b/instrumentation/aox/aox/buildinfo.inc a/instrumentation/aox/aox/buildinfo.inc
new file mode 100644
index 0000000..e69de29
diff --git b/hung_patch_from_arnt/aox/aox/db.cpp a/instrumentation/aox/aox/db.cpp
index af5edbb..24a7dca 100644
--- b/hung_patch_from_arnt/aox/aox/db.cpp
+++ a/instrumentation/aox/aox/db.cpp
@@ -173,16 +173,13 @@ void Vacuum::execute()
                 qstate = 1;
                 log( "vacuum: delete from deliveries", Log::Significant );
                 do {
-                    // Literals have changed meaning in c++11, we need spaces
-                    // or they have potentially changed effect in future
-                    // http://www.preney.ca/paul/archives/636
                     q = new Query( "delete from deliveries "
                                    "where injected_at<current_timestamp-'" +
                                    fn( days ) + " days'::interval "
                                    "and id in "
                                    "(select delivery from delivery_recipients "
                                    " where action not in ($1,$2) "
-                                   " limit " MSGBLOCKCOUNT ") "
+                                   " limit "MSGBLOCKCOUNT") "
                                    "and id not in "
                                    "(select delivery from delivery_recipients "
                                    " where action in ($1,$2))", this );
@@ -212,7 +209,7 @@ void Vacuum::execute()
                                    " left join deliveries d on (m.id=d.message)"
                                    " where mm.message is null and dm.message is null"
                                    " and d.message is null "
-                                   " limit " MSGBLOCKCOUNT ")", this );
+                                   " limit "MSGBLOCKCOUNT")", this );
                     q->execute();
             case 3:
                     if (!q->done())
@@ -224,7 +221,7 @@ void Vacuum::execute()
                     q = new Query( "delete from bodyparts where id in (select id "
                                    "from bodyparts b left join part_numbers p on "
                                    "(b.id=p.bodypart) where bodypart is null "
-                                   " limit " MSGBLOCKCOUNT ")", this );
+                                   " limit "MSGBLOCKCOUNT")", this );
                     q->execute();
             case 4:
                     if (!q->done())
diff --git b/instrumentation/aox/bin/aox a/instrumentation/aox/bin/aox
new file mode 100755
index 0000000..a0c7cf5
Binary files /dev/null and a/instrumentation/aox/bin/aox differ
diff --git b/instrumentation/aox/bin/aoxdeliver a/instrumentation/aox/bin/aoxdeliver
new file mode 100755
index 0000000..d0f84a5
Binary files /dev/null and a/instrumentation/aox/bin/aoxdeliver differ
diff --git b/instrumentation/aox/bin/aoxexport a/instrumentation/aox/bin/aoxexport
new file mode 100755
index 0000000..43fed0f
Binary files /dev/null and a/instrumentation/aox/bin/aoxexport differ
diff --git b/instrumentation/aox/bin/aoximport a/instrumentation/aox/bin/aoximport
new file mode 100755
index 0000000..7d75c1a
Binary files /dev/null and a/instrumentation/aox/bin/aoximport differ
diff --git b/instrumentation/aox/bin/archiveopteryx a/instrumentation/aox/bin/archiveopteryx
new file mode 100755
index 0000000..7a7999b
Binary files /dev/null and a/instrumentation/aox/bin/archiveopteryx differ
diff --git b/instrumentation/aox/bin/installer a/instrumentation/aox/bin/installer
new file mode 100755
index 0000000..e2243ee
Binary files /dev/null and a/instrumentation/aox/bin/installer differ
diff --git b/instrumentation/aox/bin/logd a/instrumentation/aox/bin/logd
new file mode 100755
index 0000000..73771da
Binary files /dev/null and a/instrumentation/aox/bin/logd differ
diff --git b/instrumentation/aox/bin/recorder a/instrumentation/aox/bin/recorder
new file mode 100755
index 0000000..8f46c2a
Binary files /dev/null and a/instrumentation/aox/bin/recorder differ
diff --git b/instrumentation/aox/build/clang/COPYING a/instrumentation/aox/build/clang/COPYING
new file mode 100644
index 0000000..fc34d88
--- /dev/null
+++ a/instrumentation/aox/build/clang/COPYING
@@ -0,0 +1,4 @@
+Archiveopteryx 3.2.0 is licensed to you by Oryx Mail Systems GmbH
+under the PostgreSQL License, a copy of which is enclosed in the file
+bsd.txt. We adapted the text from that used by PostgreSQL,
+http://www.postgresql.org/about/licence
diff --git b/instrumentation/aox/build/clang/README a/instrumentation/aox/build/clang/README
new file mode 100644
index 0000000..4dc59be
--- /dev/null
+++ a/instrumentation/aox/build/clang/README
@@ -0,0 +1,131 @@
+Archiveopteryx
+http://archiveopteryx.org
+
+
+See http://archiveopteryx.org/overview for an introduction
+and http://archiveopteryx.org/3.2.0 for information about
+version 3.2.0.
+
+
+Requirements
+------------
+
+You need g++ (and associated packages) to build this software.
+
+You need to have PostgreSQL installed to use Archiveopteryx. We
+recommend the latest 9.x version (but anything newer than 9.1
+should work; see http://archiveopteryx.org/postgresql/).
+
+
+Installation
+------------
+
+For detailed installation instructions, see:
+http://archiveopteryx.org/installation
+
+Here's a brief overview of the steps to follow while installing
+Archiveopteryx for the first time (see below if you're upgrading):
+
+1. Type "make" to compile the software.
+
+   We test the build on Linux and FreeBSD. You may encounter some errors
+   if you compile elsewhere. We make few demands of the platform, so any
+   errors are likely to be minor, and if you tell us about them, we'd be
+   happy to help you resolve them.
+
+2. Type "make install" as root to install the software into /usr/local/archiveopteryx
+   (then switch to that directory to continue).
+
+   The archiveopteryx(7) manual page introduces the software.
+
+   (You may want to add /usr/local/archiveopteryx/man to your MANPATH.)
+
+3. Run "lib/installer" to create a Unix user and group, a PostgreSQL
+   user, the necessary database tables, and to generate an initial
+   configuration file.
+
+   See installer(8) for details, or run "lib/installer -n" to see what
+   commands the installer would run, without running them.
+
+   The generated configuration file should work fine, but you may need
+   to edit it, for example, to enable POP3, or make the servers listen
+   on some interface other than localhost. See archiveopteryx.conf(5)
+   for more details.
+
+4. Start the servers: "bin/aox start".
+
+   aox is the command-line administration tool for Archiveopteryx.
+   See aox(8) or run "bin/aox help" for usage instructions.
+
+   The servers write log output to syslog/mail.
+
+   (To start the servers automatically at boot, use lib/archiveopteryx
+   as an init script.)
+
+5. Create some users, e.g. with:
+
+       bin/aox add user nirmala pwd nirmala@example.com
+
+   Archiveopteryx will create a user named nirmala (with password "pwd")
+   and accept mail sent to the given address, and store it in a mailbox
+   named /users/nirmala/INBOX, which can be accessed via IMAP or POP.
+
+6. Configure your MTA to deliver incoming mail into Archiveopteryx via
+   LMTP (or via bin/deliver, if your MTA doesn't speak LMTP). See, e.g.
+   http://archiveopteryx.org/postfix and .../exim for details.
+
+7. Add an entry to root's crontab to run "aox vacuum" daily. Remember to
+   enable PostgreSQL's "autovacuum" feature too (strongly recommended),
+   or at least to run "vacuumdb -qaz" from the postgres user's crontab.
+   You'll also need to adjust the memory settings in postgresql.conf
+   (shared_buffers, effective_cache_size) for better performance.
+
+
+Upgrading Archiveopteryx
+------------------------
+
+1. "make" and "make install" as above.
+
+2. Upgrade the schema, if necessary: "aox stop; aox upgrade schema"
+
+   We sometimes change the database schema between releases, so you may
+   need to stop the server and upgrade the schema. You can check if the
+   schema is up to date with "aox show schema". The new server will not
+   start until the schema is at the version it expects.
+
+   It is safe to run "aox upgrade schema" when the server is stopped. If
+   it doesn't need to do anything, it will just exit.
+
+   We try to keep schema upgrades fast, to minimise downtime.
+
+3. Restart the servers: "aox restart"
+
+4. Update the database, if necessary: "aox update database"
+
+   Very rarely, we may need to make extensive changes to the database.
+   In this case, you will need to run "aox update database" after you
+   install and start the new server. The server will operate normally
+   as the update proceeds. The release notes for a particular version
+   will always mention it if you need to update the database.
+
+   It is always safe to run "aox update database", whether the server is
+   stopped or running. If it doesn't need to do anything, it will exit.
+   If the process is terminated, it is safe to restart it; it will pick
+   up where it left off.
+
+
+Mailing Lists
+-------------
+
+There are mailing lists for Archiveopteryx users and announcements. To
+subscribe to the users list (which also gets announcements), send mail:
+
+    echo|mail -s subscribe users-request@aox.org
+
+To subscribe instead to the low-volume announcements list:
+
+    echo|mail -s subscribe announce-request@aox.org
+
+
+If you encounter any problems or have any suggestions, please write to
+info@aox.org. Your comments help us improve Archiveopteryx.
diff --git b/instrumentation/aox/build/clang/abnf/abnfparser.o a/instrumentation/aox/build/clang/abnf/abnfparser.o
new file mode 100644
index 0000000..2602b34
Binary files /dev/null and a/instrumentation/aox/build/clang/abnf/abnfparser.o differ
diff --git b/instrumentation/aox/build/clang/aox/aliases.o a/instrumentation/aox/build/clang/aox/aliases.o
new file mode 100644
index 0000000..3771d82
Binary files /dev/null and a/instrumentation/aox/build/clang/aox/aliases.o differ
diff --git b/instrumentation/aox/build/clang/aox/anonymise.o a/instrumentation/aox/build/clang/aox/anonymise.o
new file mode 100644
index 0000000..a62d614
Binary files /dev/null and a/instrumentation/aox/build/clang/aox/anonymise.o differ
diff --git b/instrumentation/aox/build/clang/aox/aox.o a/instrumentation/aox/build/clang/aox/aox.o
new file mode 100644
index 0000000..30f5c03
Binary files /dev/null and a/instrumentation/aox/build/clang/aox/aox.o differ
diff --git b/instrumentation/aox/build/clang/aox/aoxcommand.o a/instrumentation/aox/build/clang/aox/aoxcommand.o
new file mode 100644
index 0000000..cf00cf4
Binary files /dev/null and a/instrumentation/aox/build/clang/aox/aoxcommand.o differ
diff --git b/instrumentation/aox/build/clang/aox/db.o a/instrumentation/aox/build/clang/aox/db.o
new file mode 100644
index 0000000..f6af8be
Binary files /dev/null and a/instrumentation/aox/build/clang/aox/db.o differ
diff --git b/instrumentation/aox/build/clang/aox/help.o a/instrumentation/aox/build/clang/aox/help.o
new file mode 100644
index 0000000..67ac525
Binary files /dev/null and a/instrumentation/aox/build/clang/aox/help.o differ
diff --git b/instrumentation/aox/build/clang/aox/mailboxes.o a/instrumentation/aox/build/clang/aox/mailboxes.o
new file mode 100644
index 0000000..f103685
Binary files /dev/null and a/instrumentation/aox/build/clang/aox/mailboxes.o differ
diff --git b/instrumentation/aox/build/clang/aox/queue.o a/instrumentation/aox/build/clang/aox/queue.o
new file mode 100644
index 0000000..20f94c5
Binary files /dev/null and a/instrumentation/aox/build/clang/aox/queue.o differ
diff --git b/instrumentation/aox/build/clang/aox/reparse.o a/instrumentation/aox/build/clang/aox/reparse.o
new file mode 100644
index 0000000..7922513
Binary files /dev/null and a/instrumentation/aox/build/clang/aox/reparse.o differ
diff --git b/instrumentation/aox/build/clang/aox/retention.o a/instrumentation/aox/build/clang/aox/retention.o
new file mode 100644
index 0000000..a657388
Binary files /dev/null and a/instrumentation/aox/build/clang/aox/retention.o differ
diff --git b/instrumentation/aox/build/clang/aox/rights.o a/instrumentation/aox/build/clang/aox/rights.o
new file mode 100644
index 0000000..f4c84eb
Binary files /dev/null and a/instrumentation/aox/build/clang/aox/rights.o differ
diff --git b/instrumentation/aox/build/clang/aox/search.o a/instrumentation/aox/build/clang/aox/search.o
new file mode 100644
index 0000000..f9012e3
Binary files /dev/null and a/instrumentation/aox/build/clang/aox/search.o differ
diff --git b/instrumentation/aox/build/clang/aox/searchsyntax.o a/instrumentation/aox/build/clang/aox/searchsyntax.o
new file mode 100644
index 0000000..d7279c3
Binary files /dev/null and a/instrumentation/aox/build/clang/aox/searchsyntax.o differ
diff --git b/instrumentation/aox/build/clang/aox/servers.o a/instrumentation/aox/build/clang/aox/servers.o
new file mode 100644
index 0000000..d594a3a
Binary files /dev/null and a/instrumentation/aox/build/clang/aox/servers.o differ
diff --git b/instrumentation/aox/build/clang/aox/stats.o a/instrumentation/aox/build/clang/aox/stats.o
new file mode 100644
index 0000000..3623cc2
Binary files /dev/null and a/instrumentation/aox/build/clang/aox/stats.o differ
diff --git b/instrumentation/aox/build/clang/aox/undelete.o a/instrumentation/aox/build/clang/aox/undelete.o
new file mode 100644
index 0000000..7efbd62
Binary files /dev/null and a/instrumentation/aox/build/clang/aox/undelete.o differ
diff --git b/instrumentation/aox/build/clang/aox/updatedb.o a/instrumentation/aox/build/clang/aox/updatedb.o
new file mode 100644
index 0000000..ee9bc06
Binary files /dev/null and a/instrumentation/aox/build/clang/aox/updatedb.o differ
diff --git b/instrumentation/aox/build/clang/aox/users.o a/instrumentation/aox/build/clang/aox/users.o
new file mode 100644
index 0000000..ee63b34
Binary files /dev/null and a/instrumentation/aox/build/clang/aox/users.o differ
diff --git b/instrumentation/aox/build/clang/aoxexport/aoxexport.o a/instrumentation/aox/build/clang/aoxexport/aoxexport.o
new file mode 100644
index 0000000..e490ece
Binary files /dev/null and a/instrumentation/aox/build/clang/aoxexport/aoxexport.o differ
diff --git b/instrumentation/aox/build/clang/aoxexport/exporter.o a/instrumentation/aox/build/clang/aoxexport/exporter.o
new file mode 100644
index 0000000..27e2f6e
Binary files /dev/null and a/instrumentation/aox/build/clang/aoxexport/exporter.o differ
diff --git b/instrumentation/aox/build/clang/aoximport/aoximport.o a/instrumentation/aox/build/clang/aoximport/aoximport.o
new file mode 100644
index 0000000..ec463cd
Binary files /dev/null and a/instrumentation/aox/build/clang/aoximport/aoximport.o differ
diff --git b/instrumentation/aox/build/clang/aoximport/cyrus.o a/instrumentation/aox/build/clang/aoximport/cyrus.o
new file mode 100644
index 0000000..4d37550
Binary files /dev/null and a/instrumentation/aox/build/clang/aoximport/cyrus.o differ
diff --git b/instrumentation/aox/build/clang/aoximport/dirtree.o a/instrumentation/aox/build/clang/aoximport/dirtree.o
new file mode 100644
index 0000000..8b44121
Binary files /dev/null and a/instrumentation/aox/build/clang/aoximport/dirtree.o differ
diff --git b/instrumentation/aox/build/clang/aoximport/maildir.o a/instrumentation/aox/build/clang/aoximport/maildir.o
new file mode 100644
index 0000000..52cf4d4
Binary files /dev/null and a/instrumentation/aox/build/clang/aoximport/maildir.o differ
diff --git b/instrumentation/aox/build/clang/aoximport/mbox.o a/instrumentation/aox/build/clang/aoximport/mbox.o
new file mode 100644
index 0000000..21fcbdf
Binary files /dev/null and a/instrumentation/aox/build/clang/aoximport/mbox.o differ
diff --git b/instrumentation/aox/build/clang/aoximport/mh.o a/instrumentation/aox/build/clang/aoximport/mh.o
new file mode 100644
index 0000000..deb9bb3
Binary files /dev/null and a/instrumentation/aox/build/clang/aoximport/mh.o differ
diff --git b/instrumentation/aox/build/clang/aoximport/migrator.o a/instrumentation/aox/build/clang/aoximport/migrator.o
new file mode 100644
index 0000000..c327f6d
Binary files /dev/null and a/instrumentation/aox/build/clang/aoximport/migrator.o differ
diff --git b/instrumentation/aox/build/clang/archiveopteryx/archiveopteryx.o a/instrumentation/aox/build/clang/archiveopteryx/archiveopteryx.o
new file mode 100644
index 0000000..2eac91e
Binary files /dev/null and a/instrumentation/aox/build/clang/archiveopteryx/archiveopteryx.o differ
diff --git b/instrumentation/aox/build/clang/collations/ascii-casemap.o a/instrumentation/aox/build/clang/collations/ascii-casemap.o
new file mode 100644
index 0000000..80b3d9c
Binary files /dev/null and a/instrumentation/aox/build/clang/collations/ascii-casemap.o differ
diff --git b/instrumentation/aox/build/clang/collations/ascii-numeric.o a/instrumentation/aox/build/clang/collations/ascii-numeric.o
new file mode 100644
index 0000000..38ff258
Binary files /dev/null and a/instrumentation/aox/build/clang/collations/ascii-numeric.o differ
diff --git b/instrumentation/aox/build/clang/collations/collation.o a/instrumentation/aox/build/clang/collations/collation.o
new file mode 100644
index 0000000..dbada3b
Binary files /dev/null and a/instrumentation/aox/build/clang/collations/collation.o differ
diff --git b/instrumentation/aox/build/clang/collations/octet.o a/instrumentation/aox/build/clang/collations/octet.o
new file mode 100644
index 0000000..65b9039
Binary files /dev/null and a/instrumentation/aox/build/clang/collations/octet.o differ
diff --git b/instrumentation/aox/build/clang/core/allocator.o a/instrumentation/aox/build/clang/core/allocator.o
new file mode 100644
index 0000000..c161777
Binary files /dev/null and a/instrumentation/aox/build/clang/core/allocator.o differ
diff --git b/instrumentation/aox/build/clang/core/buffer.o a/instrumentation/aox/build/clang/core/buffer.o
new file mode 100644
index 0000000..82d5c42
Binary files /dev/null and a/instrumentation/aox/build/clang/core/buffer.o differ
diff --git b/instrumentation/aox/build/clang/core/cache.o a/instrumentation/aox/build/clang/core/cache.o
new file mode 100644
index 0000000..f56403b
Binary files /dev/null and a/instrumentation/aox/build/clang/core/cache.o differ
diff --git b/instrumentation/aox/build/clang/core/configuration.o a/instrumentation/aox/build/clang/core/configuration.o
new file mode 100644
index 0000000..37a06ab
Binary files /dev/null and a/instrumentation/aox/build/clang/core/configuration.o differ
diff --git b/instrumentation/aox/build/clang/core/dict.o a/instrumentation/aox/build/clang/core/dict.o
new file mode 100644
index 0000000..893673e
Binary files /dev/null and a/instrumentation/aox/build/clang/core/dict.o differ
diff --git b/instrumentation/aox/build/clang/core/entropy.o a/instrumentation/aox/build/clang/core/entropy.o
new file mode 100644
index 0000000..72f62a0
Binary files /dev/null and a/instrumentation/aox/build/clang/core/entropy.o differ
diff --git b/instrumentation/aox/build/clang/core/estring.o a/instrumentation/aox/build/clang/core/estring.o
new file mode 100644
index 0000000..1b120db
Binary files /dev/null and a/instrumentation/aox/build/clang/core/estring.o differ
diff --git b/instrumentation/aox/build/clang/core/estringlist.o a/instrumentation/aox/build/clang/core/estringlist.o
new file mode 100644
index 0000000..791a69d
Binary files /dev/null and a/instrumentation/aox/build/clang/core/estringlist.o differ
diff --git b/instrumentation/aox/build/clang/core/file.o a/instrumentation/aox/build/clang/core/file.o
new file mode 100644
index 0000000..bd6528f
Binary files /dev/null and a/instrumentation/aox/build/clang/core/file.o differ
diff --git b/instrumentation/aox/build/clang/core/global.o a/instrumentation/aox/build/clang/core/global.o
new file mode 100644
index 0000000..231b496
Binary files /dev/null and a/instrumentation/aox/build/clang/core/global.o differ
diff --git b/instrumentation/aox/build/clang/core/list.o a/instrumentation/aox/build/clang/core/list.o
new file mode 100644
index 0000000..04162d3
Binary files /dev/null and a/instrumentation/aox/build/clang/core/list.o differ
diff --git b/instrumentation/aox/build/clang/core/log.o a/instrumentation/aox/build/clang/core/log.o
new file mode 100644
index 0000000..46cf766
Binary files /dev/null and a/instrumentation/aox/build/clang/core/log.o differ
diff --git b/instrumentation/aox/build/clang/core/logger.o a/instrumentation/aox/build/clang/core/logger.o
new file mode 100644
index 0000000..40da6c8
Binary files /dev/null and a/instrumentation/aox/build/clang/core/logger.o differ
diff --git b/instrumentation/aox/build/clang/core/map.o a/instrumentation/aox/build/clang/core/map.o
new file mode 100644
index 0000000..7de8fb9
Binary files /dev/null and a/instrumentation/aox/build/clang/core/map.o differ
diff --git b/instrumentation/aox/build/clang/core/md5.o a/instrumentation/aox/build/clang/core/md5.o
new file mode 100644
index 0000000..03c38ea
Binary files /dev/null and a/instrumentation/aox/build/clang/core/md5.o differ
diff --git b/instrumentation/aox/build/clang/core/patriciatree.o a/instrumentation/aox/build/clang/core/patriciatree.o
new file mode 100644
index 0000000..c6f2031
Binary files /dev/null and a/instrumentation/aox/build/clang/core/patriciatree.o differ
diff --git b/instrumentation/aox/build/clang/core/scope.o a/instrumentation/aox/build/clang/core/scope.o
new file mode 100644
index 0000000..3847b46
Binary files /dev/null and a/instrumentation/aox/build/clang/core/scope.o differ
diff --git b/instrumentation/aox/build/clang/core/stderrlogger.o a/instrumentation/aox/build/clang/core/stderrlogger.o
new file mode 100644
index 0000000..1ae3194
Binary files /dev/null and a/instrumentation/aox/build/clang/core/stderrlogger.o differ
diff --git b/instrumentation/aox/build/clang/core/ustring.o a/instrumentation/aox/build/clang/core/ustring.o
new file mode 100644
index 0000000..3f0c249
Binary files /dev/null and a/instrumentation/aox/build/clang/core/ustring.o differ
diff --git b/instrumentation/aox/build/clang/core/ustringlist.o a/instrumentation/aox/build/clang/core/ustringlist.o
new file mode 100644
index 0000000..d918b84
Binary files /dev/null and a/instrumentation/aox/build/clang/core/ustringlist.o differ
diff --git b/instrumentation/aox/build/clang/db/database.o a/instrumentation/aox/build/clang/db/database.o
new file mode 100644
index 0000000..3ba7899
Binary files /dev/null and a/instrumentation/aox/build/clang/db/database.o differ
diff --git b/instrumentation/aox/build/clang/db/dbsignal.o a/instrumentation/aox/build/clang/db/dbsignal.o
new file mode 100644
index 0000000..adab9ad
Binary files /dev/null and a/instrumentation/aox/build/clang/db/dbsignal.o differ
diff --git b/instrumentation/aox/build/clang/db/granter.o a/instrumentation/aox/build/clang/db/granter.o
new file mode 100644
index 0000000..fefae47
Binary files /dev/null and a/instrumentation/aox/build/clang/db/granter.o differ
diff --git b/instrumentation/aox/build/clang/db/pgmessage.o a/instrumentation/aox/build/clang/db/pgmessage.o
new file mode 100644
index 0000000..e4ca43f
Binary files /dev/null and a/instrumentation/aox/build/clang/db/pgmessage.o differ
diff --git b/instrumentation/aox/build/clang/db/postgres.o a/instrumentation/aox/build/clang/db/postgres.o
new file mode 100644
index 0000000..de7b827
Binary files /dev/null and a/instrumentation/aox/build/clang/db/postgres.o differ
diff --git b/instrumentation/aox/build/clang/db/query.o a/instrumentation/aox/build/clang/db/query.o
new file mode 100644
index 0000000..88c99b8
Binary files /dev/null and a/instrumentation/aox/build/clang/db/query.o differ
diff --git b/instrumentation/aox/build/clang/db/schema.o a/instrumentation/aox/build/clang/db/schema.o
new file mode 100644
index 0000000..6c9217c
Binary files /dev/null and a/instrumentation/aox/build/clang/db/schema.o differ
diff --git b/instrumentation/aox/build/clang/db/schemachecker.o a/instrumentation/aox/build/clang/db/schemachecker.o
new file mode 100644
index 0000000..8d178c7
Binary files /dev/null and a/instrumentation/aox/build/clang/db/schemachecker.o differ
diff --git b/instrumentation/aox/build/clang/db/transaction.o a/instrumentation/aox/build/clang/db/transaction.o
new file mode 100644
index 0000000..6fa27c9
Binary files /dev/null and a/instrumentation/aox/build/clang/db/transaction.o differ
diff --git b/instrumentation/aox/build/clang/deliver/aoxdeliver.o a/instrumentation/aox/build/clang/deliver/aoxdeliver.o
new file mode 100644
index 0000000..2eba3ac
Binary files /dev/null and a/instrumentation/aox/build/clang/deliver/aoxdeliver.o differ
diff --git b/instrumentation/aox/build/clang/downgrades a/instrumentation/aox/build/clang/downgrades
new file mode 100644
index 0000000..b8c0fed
--- /dev/null
+++ a/instrumentation/aox/build/clang/downgrades
@@ -0,0 +1,155 @@
+create or replace function downgrade_to_84()
+returns int as $$
+begin
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_83()
+returns int as $$
+begin
+    drop table retention_policies;
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_82()
+returns int as $$
+begin
+    insert into flags (mailbox, uid, flag)
+        select mailbox, uid, (select id from flag_names where name=E'\\\\Seen')
+        from mailbox_messages where seen;
+    insert into flags (mailbox, uid, flag)
+        select mailbox, uid, (select id from flag_names where name=E'\\\\Deleted')
+        from mailbox_messages where deleted;
+    alter table mailbox_messages drop seen, drop deleted;
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_81()
+returns int as $$
+begin
+    drop trigger mailbox_update_trigger on mailboxes;
+    drop function check_mailbox_update();
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_80()
+returns int as $$
+begin
+    drop trigger mailbox_owner_trigger on mailboxes;
+    drop function set_mailbox_owner();
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_85()
+returns int as $$
+begin
+    drop trigger retention_policies_trigger on retention_policies;
+    drop function notify_retention_policies();
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_86()
+returns int as $$
+begin
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_87()
+returns int as $$
+begin
+    alter table users alter alias set not null;
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_88()
+returns int as $$
+begin
+    alter table connections add userid integer;
+    update connections set userid=users.id from users where users.login=connections.username;
+    alter table connections drop username;
+    alter table connections add foreign key(userid) references users(id);
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_89()
+returns int as $$
+begin
+    alter table deliveries drop deliver_after;
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_90()
+returns int as $$
+begin
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_91()
+returns int as $$
+begin
+    alter table connections drop userid;
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_92()
+returns int as $$
+begin
+    alter table users drop quota;
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_93()
+returns int as $$
+begin
+    alter table group_members rename groupid to groupname;
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_94()
+returns int as $$
+begin
+    alter table messages drop thread_root;
+    drop table thread_roots;
+    drop function merge_threads(integer,integer);
+    create table threads (
+        id serial primary key,
+        mailbox integer not null references mailboxes(id),
+        subject text,
+        unique (mailbox, subject)
+    );
+    create table thread_members (
+        thread integer not null references threads(id),
+        mailbox integer not null,
+        uid integer not null,
+        primary key (thread, mailbox, uid),
+        foreign key (mailbox, uid) references mailbox_messages(mailbox, uid)
+            on delete cascade
+    );
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_95()
+returns int as $$
+begin
+    drop index addresses_ldn_key;
+    alter table addresses alter localpart type text;
+    alter table addresses alter domain type text;
+    create unique index addresses_nld_key on addresses(name,localpart,lower(domain));
+    create index ald on addresses(lower(localpart), lower(domain));
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_96()
+returns int as $$
+begin
+    create table views (
+        id          serial primary key,
+        source      integer not null references mailboxes(id)
+                    on delete cascade,
+        view        integer not null references mailboxes(id)
+                    on delete cascade unique,
+        nextmodseq  bigint not null,
+        selector    text
+    );
+    return 0;
+end;$$ language 'plpgsql';
diff --git b/instrumentation/aox/build/clang/encodings/codec.o a/instrumentation/aox/build/clang/encodings/codec.o
new file mode 100644
index 0000000..18a2a04
Binary files /dev/null and a/instrumentation/aox/build/clang/encodings/codec.o differ
diff --git b/instrumentation/aox/build/clang/encodings/cp.o a/instrumentation/aox/build/clang/encodings/cp.o
new file mode 100644
index 0000000..7cf77a8
Binary files /dev/null and a/instrumentation/aox/build/clang/encodings/cp.o differ
diff --git b/instrumentation/aox/build/clang/encodings/cp932.o a/instrumentation/aox/build/clang/encodings/cp932.o
new file mode 100644
index 0000000..1ac946c
Binary files /dev/null and a/instrumentation/aox/build/clang/encodings/cp932.o differ
diff --git b/instrumentation/aox/build/clang/encodings/cp949.o a/instrumentation/aox/build/clang/encodings/cp949.o
new file mode 100644
index 0000000..cb48291
Binary files /dev/null and a/instrumentation/aox/build/clang/encodings/cp949.o differ
diff --git b/instrumentation/aox/build/clang/encodings/cp950.o a/instrumentation/aox/build/clang/encodings/cp950.o
new file mode 100644
index 0000000..7175490
Binary files /dev/null and a/instrumentation/aox/build/clang/encodings/cp950.o differ
diff --git b/instrumentation/aox/build/clang/encodings/ebcdic.o a/instrumentation/aox/build/clang/encodings/ebcdic.o
new file mode 100644
index 0000000..5ca9af4
Binary files /dev/null and a/instrumentation/aox/build/clang/encodings/ebcdic.o differ
diff --git b/instrumentation/aox/build/clang/encodings/eucjp.o a/instrumentation/aox/build/clang/encodings/eucjp.o
new file mode 100644
index 0000000..d517b51
Binary files /dev/null and a/instrumentation/aox/build/clang/encodings/eucjp.o differ
diff --git b/instrumentation/aox/build/clang/encodings/euckr.o a/instrumentation/aox/build/clang/encodings/euckr.o
new file mode 100644
index 0000000..21cdd75
Binary files /dev/null and a/instrumentation/aox/build/clang/encodings/euckr.o differ
diff --git b/instrumentation/aox/build/clang/encodings/gb2312.o a/instrumentation/aox/build/clang/encodings/gb2312.o
new file mode 100644
index 0000000..eb1192a
Binary files /dev/null and a/instrumentation/aox/build/clang/encodings/gb2312.o differ
diff --git b/instrumentation/aox/build/clang/encodings/gbk.o a/instrumentation/aox/build/clang/encodings/gbk.o
new file mode 100644
index 0000000..ff473c5
Binary files /dev/null and a/instrumentation/aox/build/clang/encodings/gbk.o differ
diff --git b/instrumentation/aox/build/clang/encodings/hproman8.o a/instrumentation/aox/build/clang/encodings/hproman8.o
new file mode 100644
index 0000000..3038757
Binary files /dev/null and a/instrumentation/aox/build/clang/encodings/hproman8.o differ
diff --git b/instrumentation/aox/build/clang/encodings/iso2022jp.o a/instrumentation/aox/build/clang/encodings/iso2022jp.o
new file mode 100644
index 0000000..5dc816e
Binary files /dev/null and a/instrumentation/aox/build/clang/encodings/iso2022jp.o differ
diff --git b/instrumentation/aox/build/clang/encodings/iso8859.o a/instrumentation/aox/build/clang/encodings/iso8859.o
new file mode 100644
index 0000000..7d65a93
Binary files /dev/null and a/instrumentation/aox/build/clang/encodings/iso8859.o differ
diff --git b/instrumentation/aox/build/clang/encodings/koi.o a/instrumentation/aox/build/clang/encodings/koi.o
new file mode 100644
index 0000000..86d35f3
Binary files /dev/null and a/instrumentation/aox/build/clang/encodings/koi.o differ
diff --git b/instrumentation/aox/build/clang/encodings/mac.o a/instrumentation/aox/build/clang/encodings/mac.o
new file mode 100644
index 0000000..33d1b2a
Binary files /dev/null and a/instrumentation/aox/build/clang/encodings/mac.o differ
diff --git b/instrumentation/aox/build/clang/encodings/unknown.o a/instrumentation/aox/build/clang/encodings/unknown.o
new file mode 100644
index 0000000..df46b99
Binary files /dev/null and a/instrumentation/aox/build/clang/encodings/unknown.o differ
diff --git b/instrumentation/aox/build/clang/encodings/utf.o a/instrumentation/aox/build/clang/encodings/utf.o
new file mode 100644
index 0000000..65df76d
Binary files /dev/null and a/instrumentation/aox/build/clang/encodings/utf.o differ
diff --git b/instrumentation/aox/build/clang/encodings/viscii.o a/instrumentation/aox/build/clang/encodings/viscii.o
new file mode 100644
index 0000000..d804cfd
Binary files /dev/null and a/instrumentation/aox/build/clang/encodings/viscii.o differ
diff --git b/instrumentation/aox/build/clang/extractors/html.o a/instrumentation/aox/build/clang/extractors/html.o
new file mode 100644
index 0000000..6c5da8c
Binary files /dev/null and a/instrumentation/aox/build/clang/extractors/html.o differ
diff --git b/instrumentation/aox/build/clang/field-names a/instrumentation/aox/build/clang/field-names
new file mode 100644
index 0000000..dd5aaf3
--- /dev/null
+++ a/instrumentation/aox/build/clang/field-names
@@ -0,0 +1,32 @@
+insert into field_names (name) values ('From');
+insert into field_names (name) values ('Resent-From');
+insert into field_names (name) values ('Sender');
+insert into field_names (name) values ('Resent-Sender');
+insert into field_names (name) values ('Return-Path');
+insert into field_names (name) values ('Reply-To');
+insert into field_names (name) values ('To');
+insert into field_names (name) values ('Cc');
+insert into field_names (name) values ('Bcc');
+insert into field_names (name) values ('Resent-To');
+insert into field_names (name) values ('Resent-Cc');
+insert into field_names (name) values ('Resent-Bcc');
+insert into field_names (name) values ('Message-Id');
+insert into field_names (name) values ('Resent-Message-Id');
+insert into field_names (name) values ('In-Reply-To');
+insert into field_names (name) values ('References');
+insert into field_names (name) values ('Date');
+insert into field_names (name) values ('Orig-Date');
+insert into field_names (name) values ('Resent-Date');
+insert into field_names (name) values ('Subject');
+insert into field_names (name) values ('Comments');
+insert into field_names (name) values ('Keywords');
+insert into field_names (name) values ('Content-Type');
+insert into field_names (name) values ('Content-Transfer-Encoding');
+insert into field_names (name) values ('Content-Disposition');
+insert into field_names (name) values ('Content-Description');
+insert into field_names (name) values ('Content-Id');
+insert into field_names (name) values ('Mime-Version');
+insert into field_names (name) values ('Received');
+insert into field_names (name) values ('Content-Language');
+insert into field_names (name) values ('Content-Location');
+insert into field_names (name) values ('Content-Md5');
diff --git b/instrumentation/aox/build/clang/flag-names a/instrumentation/aox/build/clang/flag-names
new file mode 100644
index 0000000..7418b77
--- /dev/null
+++ a/instrumentation/aox/build/clang/flag-names
@@ -0,0 +1,5 @@
+insert into flag_names (name) values (E'\\\\Deleted');
+insert into flag_names (name) values (E'\\\\Answered');
+insert into flag_names (name) values (E'\\\\Flagged');
+insert into flag_names (name) values (E'\\\\Draft');
+insert into flag_names (name) values (E'\\\\Seen');
diff --git b/instrumentation/aox/build/clang/fts.pg a/instrumentation/aox/build/clang/fts.pg
new file mode 100644
index 0000000..209ecd4
--- /dev/null
+++ a/instrumentation/aox/build/clang/fts.pg
@@ -0,0 +1,60 @@
+-- There are a couple of things you need to do manually:
+--
+--     1. psql archiveopteryx -f contrib/tsearch2.sql
+--     2. createlang plpgsql archiveopteryx
+--     3. Find out what your current locale is (e.g. "show lc_ctype")
+--        and execute the following statement (assuming a locale of
+--        'en_US.UTF-8'):
+--
+--        update pg_ts_cfg set locale='en_US.UTF-8' where \\
+--        ts_name='default';
+--
+-- The remainder of the script may then be executed with psql -f fts.pg.
+
+
+-- Allow Archiveopteryx to use tsearch2.
+
+grant select on pg_ts_dict to aox;
+grant select on pg_ts_parser to aox;
+grant select on pg_ts_cfg to aox;
+grant select on pg_ts_cfgmap to aox;
+
+
+-- Create a new GiST index on bodyparts.text, and a trigger to update
+-- the index every time a new entry is inserted.
+
+alter table bodyparts add ftidx tsvector;
+update bodyparts set ftidx=to_tsvector('default',text) where length(text) < 1048576;
+create index bodyparts_ftidx on bodyparts using gist(ftidx);
+vacuum full analyze bodyparts;
+
+create trigger bodyparts_ftupdate before insert on bodyparts
+for each row execute procedure tsearch2(ftidx, text);
+
+
+-- XXX: The following code is disabled, because we use copy ... binary
+-- to populate header_fields, and there's no binary input function for
+-- the tsvector type. Do we have to use INSERT if we're running with
+-- db = postgres+tsearch2? If so, perhaps we can use COPY on structured
+-- and INSERT on unstructured fields?
+--
+-- Create a new GiST index on header_fields.value for Subject fields,
+-- and a trigger to update the index every time a new Subject field
+-- is inserted.
+--
+-- alter table header_fields add subjectidx tsvector;
+-- update header_fields set subjectidx=to_tsvector('default',value) where field=20;
+-- create index hf_subjectidx on header_fields using gist(subjectidx) where field=20;
+-- vacuum full analyze header_fields;
+--
+-- create function tsearch2_subject() returns trigger as $$
+-- begin
+--     if NEW.field = 20 then
+--         perform tsearch2(NEW.subjectidx, NEW.value);
+--     end if;
+--     return NEW;
+-- end;
+-- $$ language plpgsql;
+--
+-- create trigger hf_ftupdate before insert on header_fields
+-- for each row execute procedure tsearch2_subject();
diff --git b/instrumentation/aox/build/clang/imap/command.o a/instrumentation/aox/build/clang/imap/command.o
new file mode 100644
index 0000000..eae7162
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/command.o differ
diff --git b/instrumentation/aox/build/clang/imap/eventmap.o a/instrumentation/aox/build/clang/imap/eventmap.o
new file mode 100644
index 0000000..d0b13c7
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/eventmap.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/acl.o a/instrumentation/aox/build/clang/imap/handlers/acl.o
new file mode 100644
index 0000000..e9b9574
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/acl.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/append.o a/instrumentation/aox/build/clang/imap/handlers/append.o
new file mode 100644
index 0000000..229460d
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/append.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/authenticate.o a/instrumentation/aox/build/clang/imap/handlers/authenticate.o
new file mode 100644
index 0000000..41ff27c
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/authenticate.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/capability.o a/instrumentation/aox/build/clang/imap/handlers/capability.o
new file mode 100644
index 0000000..b892f89
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/capability.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/close.o a/instrumentation/aox/build/clang/imap/handlers/close.o
new file mode 100644
index 0000000..1d74d00
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/close.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/compress.o a/instrumentation/aox/build/clang/imap/handlers/compress.o
new file mode 100644
index 0000000..f75fd99
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/compress.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/copy.o a/instrumentation/aox/build/clang/imap/handlers/copy.o
new file mode 100644
index 0000000..1489fe3
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/copy.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/create.o a/instrumentation/aox/build/clang/imap/handlers/create.o
new file mode 100644
index 0000000..d1a4e55
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/create.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/delete.o a/instrumentation/aox/build/clang/imap/handlers/delete.o
new file mode 100644
index 0000000..06a892d
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/delete.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/enable.o a/instrumentation/aox/build/clang/imap/handlers/enable.o
new file mode 100644
index 0000000..b2f7fad
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/enable.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/expunge.o a/instrumentation/aox/build/clang/imap/handlers/expunge.o
new file mode 100644
index 0000000..7911653
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/expunge.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/fetch.o a/instrumentation/aox/build/clang/imap/handlers/fetch.o
new file mode 100644
index 0000000..fb04f78
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/fetch.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/genurlauth.o a/instrumentation/aox/build/clang/imap/handlers/genurlauth.o
new file mode 100644
index 0000000..4630a26
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/genurlauth.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/id.o a/instrumentation/aox/build/clang/imap/handlers/id.o
new file mode 100644
index 0000000..b298835
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/id.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/idle.o a/instrumentation/aox/build/clang/imap/handlers/idle.o
new file mode 100644
index 0000000..9838e8c
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/idle.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/listext.o a/instrumentation/aox/build/clang/imap/handlers/listext.o
new file mode 100644
index 0000000..0ae1381
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/listext.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/login.o a/instrumentation/aox/build/clang/imap/handlers/login.o
new file mode 100644
index 0000000..c01b76f
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/login.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/logout.o a/instrumentation/aox/build/clang/imap/handlers/logout.o
new file mode 100644
index 0000000..36f2d1a
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/logout.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/lsub.o a/instrumentation/aox/build/clang/imap/handlers/lsub.o
new file mode 100644
index 0000000..7c8b41d
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/lsub.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/move.o a/instrumentation/aox/build/clang/imap/handlers/move.o
new file mode 100644
index 0000000..e130c6a
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/move.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/namespace.o a/instrumentation/aox/build/clang/imap/handlers/namespace.o
new file mode 100644
index 0000000..838b294
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/namespace.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/noop.o a/instrumentation/aox/build/clang/imap/handlers/noop.o
new file mode 100644
index 0000000..fa15b9c
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/noop.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/notify.o a/instrumentation/aox/build/clang/imap/handlers/notify.o
new file mode 100644
index 0000000..970f49d
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/notify.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/quota.o a/instrumentation/aox/build/clang/imap/handlers/quota.o
new file mode 100644
index 0000000..efd1f3a
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/quota.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/rename.o a/instrumentation/aox/build/clang/imap/handlers/rename.o
new file mode 100644
index 0000000..3738e66
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/rename.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/resetkey.o a/instrumentation/aox/build/clang/imap/handlers/resetkey.o
new file mode 100644
index 0000000..c12145b
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/resetkey.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/search.o a/instrumentation/aox/build/clang/imap/handlers/search.o
new file mode 100644
index 0000000..6f5e659
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/search.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/select.o a/instrumentation/aox/build/clang/imap/handlers/select.o
new file mode 100644
index 0000000..8124c8e
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/select.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/sort.o a/instrumentation/aox/build/clang/imap/handlers/sort.o
new file mode 100644
index 0000000..8bce33f
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/sort.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/starttls.o a/instrumentation/aox/build/clang/imap/handlers/starttls.o
new file mode 100644
index 0000000..7d1f394
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/starttls.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/status.o a/instrumentation/aox/build/clang/imap/handlers/status.o
new file mode 100644
index 0000000..539a087
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/status.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/store.o a/instrumentation/aox/build/clang/imap/handlers/store.o
new file mode 100644
index 0000000..96a14bc
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/store.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/subscribe.o a/instrumentation/aox/build/clang/imap/handlers/subscribe.o
new file mode 100644
index 0000000..d15c4c8
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/subscribe.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/thread.o a/instrumentation/aox/build/clang/imap/handlers/thread.o
new file mode 100644
index 0000000..68369bb
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/thread.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/unselect.o a/instrumentation/aox/build/clang/imap/handlers/unselect.o
new file mode 100644
index 0000000..809e91e
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/unselect.o differ
diff --git b/instrumentation/aox/build/clang/imap/handlers/urlfetch.o a/instrumentation/aox/build/clang/imap/handlers/urlfetch.o
new file mode 100644
index 0000000..492ffc5
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/handlers/urlfetch.o differ
diff --git b/instrumentation/aox/build/clang/imap/imap.o a/instrumentation/aox/build/clang/imap/imap.o
new file mode 100644
index 0000000..e264880
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/imap.o differ
diff --git b/instrumentation/aox/build/clang/imap/imapparser.o a/instrumentation/aox/build/clang/imap/imapparser.o
new file mode 100644
index 0000000..e7f642f
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/imapparser.o differ
diff --git b/instrumentation/aox/build/clang/imap/imapresponse.o a/instrumentation/aox/build/clang/imap/imapresponse.o
new file mode 100644
index 0000000..3051f06
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/imapresponse.o differ
diff --git b/instrumentation/aox/build/clang/imap/imapsession.o a/instrumentation/aox/build/clang/imap/imapsession.o
new file mode 100644
index 0000000..fc9c362
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/imapsession.o differ
diff --git b/instrumentation/aox/build/clang/imap/imapurl.o a/instrumentation/aox/build/clang/imap/imapurl.o
new file mode 100644
index 0000000..492d208
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/imapurl.o differ
diff --git b/instrumentation/aox/build/clang/imap/imapurlfetcher.o a/instrumentation/aox/build/clang/imap/imapurlfetcher.o
new file mode 100644
index 0000000..0759501
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/imapurlfetcher.o differ
diff --git b/instrumentation/aox/build/clang/imap/mailboxgroup.o a/instrumentation/aox/build/clang/imap/mailboxgroup.o
new file mode 100644
index 0000000..fb46c7f
Binary files /dev/null and a/instrumentation/aox/build/clang/imap/mailboxgroup.o differ
diff --git b/instrumentation/aox/build/clang/installer/installer.o a/instrumentation/aox/build/clang/installer/installer.o
new file mode 100644
index 0000000..c343e6d
Binary files /dev/null and a/instrumentation/aox/build/clang/installer/installer.o differ
diff --git b/instrumentation/aox/build/clang/license.txt a/instrumentation/aox/build/clang/license.txt
new file mode 100644
index 0000000..c70c380
--- /dev/null
+++ a/instrumentation/aox/build/clang/license.txt
@@ -0,0 +1,18 @@
+Copyright (c) 2003-2014, Archiveopteryx and its contributors.
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose, without fee, and without a written
+agreement is hereby granted, provided that the above copyright notice
+and this paragraph and the following two paragraphs appear in all
+copies.
+
+IN NO EVENT SHALL ORYX BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+ORYX HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ORYX SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
+BASIS, AND ORYX HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
diff --git b/instrumentation/aox/build/clang/logd/logd.o a/instrumentation/aox/build/clang/logd/logd.o
new file mode 100644
index 0000000..89ab12b
Binary files /dev/null and a/instrumentation/aox/build/clang/logd/logd.o differ
diff --git b/instrumentation/aox/build/clang/logd/logserver.o a/instrumentation/aox/build/clang/logd/logserver.o
new file mode 100644
index 0000000..de33b9c
Binary files /dev/null and a/instrumentation/aox/build/clang/logd/logserver.o differ
diff --git b/instrumentation/aox/build/clang/logd/selflogger.o a/instrumentation/aox/build/clang/logd/selflogger.o
new file mode 100644
index 0000000..22efadc
Binary files /dev/null and a/instrumentation/aox/build/clang/logd/selflogger.o differ
diff --git b/instrumentation/aox/build/clang/message/address.o a/instrumentation/aox/build/clang/message/address.o
new file mode 100644
index 0000000..bb585fc
Binary files /dev/null and a/instrumentation/aox/build/clang/message/address.o differ
diff --git b/instrumentation/aox/build/clang/message/addressfield.o a/instrumentation/aox/build/clang/message/addressfield.o
new file mode 100644
index 0000000..28c01ea
Binary files /dev/null and a/instrumentation/aox/build/clang/message/addressfield.o differ
diff --git b/instrumentation/aox/build/clang/message/annotation.o a/instrumentation/aox/build/clang/message/annotation.o
new file mode 100644
index 0000000..1e65abe
Binary files /dev/null and a/instrumentation/aox/build/clang/message/annotation.o differ
diff --git b/instrumentation/aox/build/clang/message/bodypart.o a/instrumentation/aox/build/clang/message/bodypart.o
new file mode 100644
index 0000000..24d7cbd
Binary files /dev/null and a/instrumentation/aox/build/clang/message/bodypart.o differ
diff --git b/instrumentation/aox/build/clang/message/date.o a/instrumentation/aox/build/clang/message/date.o
new file mode 100644
index 0000000..d719979
Binary files /dev/null and a/instrumentation/aox/build/clang/message/date.o differ
diff --git b/instrumentation/aox/build/clang/message/datefield.o a/instrumentation/aox/build/clang/message/datefield.o
new file mode 100644
index 0000000..a1eb37f
Binary files /dev/null and a/instrumentation/aox/build/clang/message/datefield.o differ
diff --git b/instrumentation/aox/build/clang/message/dsn.o a/instrumentation/aox/build/clang/message/dsn.o
new file mode 100644
index 0000000..a0100f5
Binary files /dev/null and a/instrumentation/aox/build/clang/message/dsn.o differ
diff --git b/instrumentation/aox/build/clang/message/fetcher.o a/instrumentation/aox/build/clang/message/fetcher.o
new file mode 100644
index 0000000..1d5c380
Binary files /dev/null and a/instrumentation/aox/build/clang/message/fetcher.o differ
diff --git b/instrumentation/aox/build/clang/message/field.o a/instrumentation/aox/build/clang/message/field.o
new file mode 100644
index 0000000..bb08ca0
Binary files /dev/null and a/instrumentation/aox/build/clang/message/field.o differ
diff --git b/instrumentation/aox/build/clang/message/flag.o a/instrumentation/aox/build/clang/message/flag.o
new file mode 100644
index 0000000..7970e47
Binary files /dev/null and a/instrumentation/aox/build/clang/message/flag.o differ
diff --git b/instrumentation/aox/build/clang/message/header.o a/instrumentation/aox/build/clang/message/header.o
new file mode 100644
index 0000000..3d825e1
Binary files /dev/null and a/instrumentation/aox/build/clang/message/header.o differ
diff --git b/instrumentation/aox/build/clang/message/helperrowcreator.o a/instrumentation/aox/build/clang/message/helperrowcreator.o
new file mode 100644
index 0000000..a5f5a9d
Binary files /dev/null and a/instrumentation/aox/build/clang/message/helperrowcreator.o differ
diff --git b/instrumentation/aox/build/clang/message/injector.o a/instrumentation/aox/build/clang/message/injector.o
new file mode 100644
index 0000000..2020eb5
Binary files /dev/null and a/instrumentation/aox/build/clang/message/injector.o differ
diff --git b/instrumentation/aox/build/clang/message/listidfield.o a/instrumentation/aox/build/clang/message/listidfield.o
new file mode 100644
index 0000000..9a3a700
Binary files /dev/null and a/instrumentation/aox/build/clang/message/listidfield.o differ
diff --git b/instrumentation/aox/build/clang/message/message.o a/instrumentation/aox/build/clang/message/message.o
new file mode 100644
index 0000000..50a25b4
Binary files /dev/null and a/instrumentation/aox/build/clang/message/message.o differ
diff --git b/instrumentation/aox/build/clang/message/messagecache.o a/instrumentation/aox/build/clang/message/messagecache.o
new file mode 100644
index 0000000..ef9b2b9
Binary files /dev/null and a/instrumentation/aox/build/clang/message/messagecache.o differ
diff --git b/instrumentation/aox/build/clang/message/mimefields.o a/instrumentation/aox/build/clang/message/mimefields.o
new file mode 100644
index 0000000..ad5d050
Binary files /dev/null and a/instrumentation/aox/build/clang/message/mimefields.o differ
diff --git b/instrumentation/aox/build/clang/message/multipart.o a/instrumentation/aox/build/clang/message/multipart.o
new file mode 100644
index 0000000..ec5792e
Binary files /dev/null and a/instrumentation/aox/build/clang/message/multipart.o differ
diff --git b/instrumentation/aox/build/clang/message/parser.o a/instrumentation/aox/build/clang/message/parser.o
new file mode 100644
index 0000000..652832a
Binary files /dev/null and a/instrumentation/aox/build/clang/message/parser.o differ
diff --git b/instrumentation/aox/build/clang/message/recipient.o a/instrumentation/aox/build/clang/message/recipient.o
new file mode 100644
index 0000000..92158b5
Binary files /dev/null and a/instrumentation/aox/build/clang/message/recipient.o differ
diff --git b/instrumentation/aox/build/clang/message/smtpclient.o a/instrumentation/aox/build/clang/message/smtpclient.o
new file mode 100644
index 0000000..cf4e313
Binary files /dev/null and a/instrumentation/aox/build/clang/message/smtpclient.o differ
diff --git b/instrumentation/aox/build/clang/pop/pop.o a/instrumentation/aox/build/clang/pop/pop.o
new file mode 100644
index 0000000..3c6e81a
Binary files /dev/null and a/instrumentation/aox/build/clang/pop/pop.o differ
diff --git b/instrumentation/aox/build/clang/pop/popcommand.o a/instrumentation/aox/build/clang/pop/popcommand.o
new file mode 100644
index 0000000..3a6b55a
Binary files /dev/null and a/instrumentation/aox/build/clang/pop/popcommand.o differ
diff --git b/instrumentation/aox/build/clang/recorder/recorder.o a/instrumentation/aox/build/clang/recorder/recorder.o
new file mode 100644
index 0000000..7bd4888
Binary files /dev/null and a/instrumentation/aox/build/clang/recorder/recorder.o differ
diff --git b/instrumentation/aox/build/clang/sasl/anonymous.o a/instrumentation/aox/build/clang/sasl/anonymous.o
new file mode 100644
index 0000000..2da7c57
Binary files /dev/null and a/instrumentation/aox/build/clang/sasl/anonymous.o differ
diff --git b/instrumentation/aox/build/clang/sasl/cram-md5.o a/instrumentation/aox/build/clang/sasl/cram-md5.o
new file mode 100644
index 0000000..82b17fa
Binary files /dev/null and a/instrumentation/aox/build/clang/sasl/cram-md5.o differ
diff --git b/instrumentation/aox/build/clang/sasl/digest-md5.o a/instrumentation/aox/build/clang/sasl/digest-md5.o
new file mode 100644
index 0000000..82c5554
Binary files /dev/null and a/instrumentation/aox/build/clang/sasl/digest-md5.o differ
diff --git b/instrumentation/aox/build/clang/sasl/ldaprelay.o a/instrumentation/aox/build/clang/sasl/ldaprelay.o
new file mode 100644
index 0000000..d73e8fa
Binary files /dev/null and a/instrumentation/aox/build/clang/sasl/ldaprelay.o differ
diff --git b/instrumentation/aox/build/clang/sasl/mechanism.o a/instrumentation/aox/build/clang/sasl/mechanism.o
new file mode 100644
index 0000000..d204013
Binary files /dev/null and a/instrumentation/aox/build/clang/sasl/mechanism.o differ
diff --git b/instrumentation/aox/build/clang/sasl/plain.o a/instrumentation/aox/build/clang/sasl/plain.o
new file mode 100644
index 0000000..ef75554
Binary files /dev/null and a/instrumentation/aox/build/clang/sasl/plain.o differ
diff --git b/instrumentation/aox/build/clang/sasl/saslconnection.o a/instrumentation/aox/build/clang/sasl/saslconnection.o
new file mode 100644
index 0000000..d19447c
Binary files /dev/null and a/instrumentation/aox/build/clang/sasl/saslconnection.o differ
diff --git b/instrumentation/aox/build/clang/sasl/sasllogin.o a/instrumentation/aox/build/clang/sasl/sasllogin.o
new file mode 100644
index 0000000..8b592ab
Binary files /dev/null and a/instrumentation/aox/build/clang/sasl/sasllogin.o differ
diff --git b/instrumentation/aox/build/clang/schema.pg a/instrumentation/aox/build/clang/schema.pg
new file mode 100644
index 0000000..6486eeb
--- /dev/null
+++ a/instrumentation/aox/build/clang/schema.pg
@@ -0,0 +1,561 @@
+-- See http://archiveopteryx.org/db/ for documentation.
+
+-- Each table is documented in an eponymous /db/ page. For example,
+-- http://archiveopteryx.org/db/addresses describes the addresses
+-- table.
+
+-- Finally, http://archiveopteryx.org/schema is a quick overview.
+
+
+-- This table contains information internal to the mailstore.
+-- For now, its only purpose is to coordinate schema updates.
+
+create table mailstore (
+    -- Grant: select, update
+    revision    integer not null primary key
+);
+insert into mailstore (revision) values (97);
+
+
+-- One entry for each unique address we've encountered.
+
+create extension if not exists citext;
+create table addresses (
+    -- Grant: select, insert
+    id          serial primary key,
+    name        text,
+    localpart   citext,
+    domain      citext
+);
+create unique index addresses_ldn_key on addresses(localpart,domain,name);
+
+
+-- One entry per "other users" namespace. Personal namespaces are
+-- implicitly created within these.
+
+create table namespaces (
+    id          serial primary key,
+    name        text not null unique
+);
+insert into namespaces (name) values ('/users');
+
+
+-- One entry per Archiveopteryx user. Used for authentication.
+
+create table users (
+    id          serial primary key,
+    login       text,
+    secret      text,
+    ldapdn      text,
+    parentspace integer not null references namespaces(id),
+    quota       bigint not null default 2147483647
+);
+create unique index u_l on users (lower(login));
+
+
+-- One entry per group of users.
+
+create table groups (
+    id          serial primary key,
+    name        text
+);
+
+
+-- One entry for each group member.
+
+create table group_members (
+    groupid     integer not null references groups(id),
+    member      integer not null references users(id),
+    primary key (groupid, member)
+);
+
+
+-- One entry per deliverable mailbox.
+
+create table mailboxes (
+    -- Grant: select, insert, update
+    id          serial primary key,
+    name        text not null unique,
+    owner       integer references users(id),
+
+    -- The UID that will be assigned to the next delivered message.
+    -- Incremented after each successful delivery.
+    uidnext     integer not null default 1,
+
+    -- The next modsequence value for this mailbox.
+    nextmodseq  bigint not null default 1,
+
+    -- The UID of the first message that should be marked \\Recent.
+    -- Set to uidnext when each new IMAP session is created.
+    first_recent integer not null default 1,
+
+    -- The IMAP mailbox UIDVALIDITY value, which, along with a message UID,
+    -- is forever guaranteed to uniquely refer to a single message.
+    uidvalidity integer not null default 1,
+
+    -- When a mailbox is deleted, its entry is marked (not removed), so
+    -- that its UIDVALIDITY can be incremented if it is ever re-created.
+    deleted     boolean not null default false
+);
+
+
+-- When aoximport or others create /users/foo/bar, bar needs to own
+-- the mailbox, so ensure that that happens.
+
+create function set_mailbox_owner() returns trigger as $$
+begin
+    if new.owner is null then
+    select into new.owner u.id
+        from users u join namespaces n on (u.parentspace=n.id)
+        where new.name like n.name||'/'||u.login||'/%'
+        or new.name = n.name||'/'||u.login limit 1;
+    end if;
+    return new;
+end;
+$$ language 'plpgsql';
+
+create trigger mailbox_owner_trigger
+before insert on mailboxes for each
+row execute procedure set_mailbox_owner();
+
+-- Ensure that mailboxes cannot be deleted while something relies on
+-- their existence
+
+create function check_mailbox_update() returns trigger as $$
+declare address text;
+begin
+    notify mailboxes_updated;
+    if new.deleted='t' and old.deleted='f' then
+        perform * from mailbox_messages where mailbox=new.id;
+        if found then
+            raise exception '% is not empty', new.name;
+        end if;
+        select a.localpart||'@'||a.domain into address
+            from addresses a join aliases al on (a.id=al.address)
+            where al.mailbox=new.id;
+        if address is not null then
+            raise exception '% used by alias %', new.name, address;
+        end if;
+        perform * from fileinto_targets where mailbox=new.id;
+        if found then
+            raise exception '% is used by sieve fileinto', new.name;
+        end if;
+    end if;
+    return new;
+end;
+$$ language 'plpgsql';
+
+create trigger mailbox_update_trigger
+before update on mailboxes for each
+row execute procedure check_mailbox_update();
+
+
+-- One entry per delivery alias: mail to the given address should be
+-- accepted and delivered into the given mailbox.
+
+create table aliases (
+    -- Grant: select, update
+    id          serial primary key,
+    address     integer not null unique references addresses(id),
+    mailbox     integer not null references mailboxes(id)
+                on delete cascade
+);
+
+
+alter table users add alias integer references aliases(id);
+
+
+-- One row per <identifier, rights> entry for a mailbox.
+
+create table permissions (
+    -- Grant: select, insert, delete, update
+    mailbox     integer not null references mailboxes(id),
+    identifier  text not null,
+    rights      text not null,
+    primary key (mailbox, identifier)
+);
+
+
+-- One entry for each Message-ID that begins a thread (for THREAD=REFS)
+
+create table thread_roots (
+    -- Grant: select, insert, update
+    id          serial primary key,
+    messageid   text not null unique
+);
+
+
+-- One entry per message stored
+
+create table messages (
+    -- Grant: select, insert
+    id          serial primary key,
+    idate       integer not null,
+    rfc822size  integer,
+    thread_root integer references thread_roots(id)
+);
+
+
+-- One (mailbox, uid) entry per message and mailbox.
+
+create table mailbox_messages (
+    -- Grant: select, insert, update
+    mailbox     integer not null references mailboxes(id),
+    uid         integer not null,
+    message     integer not null references messages(id),
+    modseq      bigint not null,
+    seen        boolean not null default false,
+    deleted     boolean not null default false,
+    primary key (mailbox, uid)
+);
+
+create index mm_m on mailbox_messages(message);
+
+
+-- One entry for the text of each unique MIME body part.
+-- Entries here may be shared by more than one message.
+
+create sequence bodypart_ids;
+create table bodyparts (
+    -- Grant: select, insert
+    id          integer default nextval('bodypart_ids') primary key,
+    bytes       integer not null,
+    hash        text not null,
+    text        text,
+    data        bytea
+);
+create index b_h on bodyparts(hash);
+
+
+-- One entry for each bodypart in a message.
+
+create table part_numbers (
+    -- Grant: select, insert
+    message     integer references messages(id) on delete cascade,
+    part        text not null,
+    bodypart    integer references bodyparts(id),
+    bytes       integer,
+    lines       integer,
+    primary key (message, part)
+);
+create index pn_b on part_numbers(bodypart);
+
+
+-- One entry for each field name we've seen (From, To, Subject, etc.).
+-- (This table is partially populated from the field-names file.)
+
+create table field_names (
+    -- Grant: select, insert
+    id          serial primary key,
+    name        text unique
+);
+
+
+-- One entry for each header field in a message, except address fields.
+
+create table header_fields (
+    -- Grant: select, insert
+    id          serial primary key,
+    message     integer not null,
+    part        text not null,
+    position    integer not null,
+    field       integer not null references field_names(id),
+    value       text,
+    unique (message, part, position, field),
+    foreign key (message, part)
+                references part_numbers(message, part)
+                on delete cascade
+);
+
+create index hf_msgid on header_fields(value) where field=13;
+
+
+-- One entry for each address associated with a message. Address
+-- fields are stored as one or more row here.
+
+create table address_fields (
+    -- Grant: select, insert
+    message     integer not null,
+    part        text not null,
+    position    integer not null,
+    field       integer not null,
+    number      integer,
+    address     integer not null references addresses(id),
+    foreign key (message, part)
+                references part_numbers(message, part)
+                on delete cascade
+);
+create index af_mp on address_fields (message, part);
+
+
+-- The Date field from each message.
+
+create table date_fields (
+    -- Grant: select, insert
+    message     integer not null references messages(id)
+                on delete cascade,
+    value       timestamp with time zone
+);
+
+create index df_m on date_fields(message);
+
+
+-- One entry per user-defined flag name to be used in flags.
+
+create table flag_names (
+    -- Grant: select, insert
+    id          serial primary key,
+    name        text
+);
+create unique index fn_uname on flag_names(lower(name));
+
+
+-- One entry per user-defined IMAP message flag per message.
+
+create table flags (
+    -- Grant: select, insert, delete
+    mailbox     integer not null,
+    uid         integer not null,
+    flag        integer not null references flag_names(id),
+    foreign key (mailbox, uid)
+                references mailbox_messages(mailbox, uid)
+                on delete cascade
+);
+create index fl_mu on flags (mailbox, uid);
+
+
+-- One entry per subscribed mailbox per user.
+
+create table subscriptions (
+    -- Grant: select, insert, delete
+    id          serial primary key,
+    owner       integer not null references users(id)
+                on delete cascade,
+    mailbox     integer not null references mailboxes(id),
+    unique(owner, mailbox)
+);
+
+
+-- One entry per vendor- or RFC-defined name to be used in annotations.
+
+create table annotation_names (
+    -- Grant: select, insert
+    id          serial primary key,
+    name        text unique
+);
+
+
+-- One entry per annotation.
+
+create table annotations (
+    -- Grant: select, insert, delete, update
+    id          serial primary key,
+    mailbox     integer not null,
+    uid         integer not null,
+    owner       integer references users(id) on delete cascade,
+    name        integer not null references annotation_names(id),
+    value       text,
+    unique (mailbox, uid, owner, name),
+    foreign key (mailbox, uid)
+                references mailbox_messages(mailbox, uid)
+                on delete cascade
+);
+
+
+-- One entry per SIEVE script owned by a user.
+
+create table scripts (
+    -- Grant: select, insert, delete, update
+    id          serial primary key,
+    owner       integer not null references users(id)
+                on delete cascade,
+    name        text,
+    active      boolean not null default 'f',
+    script      text,
+    unique (owner, name)
+);
+
+
+-- One entry per deleted (EXPUNGEd) message. A row here says "message
+-- #n used to be (mailbox,uid) until it was deleted_by ... at ...". A
+-- given pair of (mailbox,uid) may exist either in mailbox_messages or
+-- here, never in both.
+
+create table deleted_messages (
+    -- Grant: select, insert
+    mailbox     integer not null references mailboxes(id),
+    uid         integer not null,
+    message     integer not null references messages(id)
+                on delete cascade,
+    modseq      bigint not null,
+    deleted_by  integer references users(id),
+    deleted_at  timestamp with time zone not null
+                default current_timestamp,
+    reason      text,
+    primary key (mailbox, uid)
+);
+
+create index dm_mud on deleted_messages(mailbox,uid,deleted_at);
+create index dm_mm on deleted_messages(mailbox,modseq);
+create index dm_m on deleted_messages(message);
+
+
+-- When an entry is inserted into deleted_messages, we delete the
+-- corresponding row from mailbox_messages.
+
+create function delete_message() returns trigger as $$
+begin
+    delete from mailbox_messages where mailbox=NEW.mailbox and uid=NEW.uid;
+    return NULL;
+end;
+$$ language plpgsql security definer;
+
+create trigger deleted_messages_trigger
+after insert on deleted_messages
+for each row execute procedure delete_message();
+
+-- One entry for each pending SMTP-submitted delivery.
+
+create table deliveries (
+    -- Grant: select, insert, delete, update
+    id          serial primary key,
+    sender      integer not null references addresses(id),
+    message     integer not null references messages(id)
+                on delete cascade
+                unique,
+    injected_at timestamp with time zone,
+    expires_at  timestamp with time zone,
+    deliver_after timestamp with time zone
+);
+
+
+-- One entry for each recipient of pending outgoing mail.
+
+create table delivery_recipients (
+    -- Grant: select, insert, update
+    id          serial primary key,
+    delivery    integer not null references deliveries(id)
+                on delete cascade,
+    recipient   integer not null references addresses(id),
+    last_attempt timestamp with time zone,
+    action      integer not null default 0,
+    status      text
+);
+
+
+-- Each entry contains a single user's access key to a given mailbox.
+-- (See URLAUTH, RFC 4467.)
+
+create table access_keys (
+    -- Grant: select, insert, delete
+    userid      integer not null references users(id)
+                on delete cascade,
+    mailbox     integer not null references mailboxes(id)
+                on delete cascade,
+    key         text not null,
+    primary key (userid, mailbox)
+);
+
+
+-- One entry for each bodypart that represents an unparseable message
+-- that was wrapped as an application/octet-stream.
+
+create table unparsed_messages (
+    -- Grant: insert
+    bodypart    integer not null references bodyparts(id)
+                on delete cascade,
+    primary key(bodypart)
+);
+
+
+-- One entry for every autoresponse we send.
+
+create table autoresponses (
+    -- Grant: select, insert
+    id          serial primary key,
+    sent_from   integer not null references addresses(id),
+    sent_to     integer not null references addresses(id),
+    expires_at  timestamp with time zone not null
+                default current_timestamp+interval '7 days',
+    handle      text
+);
+
+
+-- One entry for every (authenticated) connection made to any of the
+-- servers.
+
+create table connections (
+    -- Grant: insert
+    id          serial primary key,
+    userid      integer,
+    username    text,
+    address     inet not null,
+    port        integer not null,
+    mechanism   varchar not null,
+    authfailures integer not null,
+    syntaxerrors integer not null,
+    started_at  timestamp with time zone not null,
+    ended_at    timestamp with time zone not null
+);
+
+
+-- One entry for each mailbox used by a given script as a target for a
+-- "fileinto". These mailboxes must not be deleted, since that would
+-- cause the referring script to fail.
+
+create table fileinto_targets (
+    -- Grant: select, insert, delete
+    id          serial primary key,
+    script      integer not null references scripts(id)
+                on delete cascade,
+    mailbox     integer not null references mailboxes(id),
+    unique(script, mailbox)
+);
+
+
+-- One entry for each message that a poor misguided Exchange/Outlook
+-- contributes to its idea of a thread. Used to turn E/O threading
+-- into what the rest of the universe uses.
+
+create table thread_indexes (
+    -- Grant: select, insert
+    message     integer not null references messages(id)
+                on delete cascade,
+    thread_index text
+);
+
+create index ti_outlook_hack on thread_indexes(thread_index);
+
+
+-- One row for each explicit retention policy defined by the
+-- administrator.
+
+create table retention_policies (
+    id          serial primary key,
+    action      text not null,
+    mailbox     integer references mailboxes(id),
+    duration    integer not null,
+    selector    text,
+    constraint rp_action check (action in ('retain','delete'))
+);
+
+create or replace function notify_retention_policies()
+returns trigger as $$
+begin
+    notify retention_policies_updated;
+    return NULL;
+end;$$ language 'plpgsql';
+
+create trigger retention_policies_trigger
+after insert or update or delete
+on retention_policies
+for each statement
+execute procedure notify_retention_policies();
+
+create or replace function merge_threads(t integer, f integer) returns int as $$
+begin
+    -- Grant: execute
+    update messages set thread_root=t where thread_root=f;
+    return 0;
+end;
+$$ language 'plpgsql' security definer;
diff --git b/instrumentation/aox/build/clang/server/connection.o a/instrumentation/aox/build/clang/server/connection.o
new file mode 100644
index 0000000..35e6963
Binary files /dev/null and a/instrumentation/aox/build/clang/server/connection.o differ
diff --git b/instrumentation/aox/build/clang/server/egd.o a/instrumentation/aox/build/clang/server/egd.o
new file mode 100644
index 0000000..4e28735
Binary files /dev/null and a/instrumentation/aox/build/clang/server/egd.o differ
diff --git b/instrumentation/aox/build/clang/server/endpoint.o a/instrumentation/aox/build/clang/server/endpoint.o
new file mode 100644
index 0000000..13fa558
Binary files /dev/null and a/instrumentation/aox/build/clang/server/endpoint.o differ
diff --git b/instrumentation/aox/build/clang/server/event.o a/instrumentation/aox/build/clang/server/event.o
new file mode 100644
index 0000000..c79c064
Binary files /dev/null and a/instrumentation/aox/build/clang/server/event.o differ
diff --git b/instrumentation/aox/build/clang/server/eventloop.o a/instrumentation/aox/build/clang/server/eventloop.o
new file mode 100644
index 0000000..1cf2cbb
Binary files /dev/null and a/instrumentation/aox/build/clang/server/eventloop.o differ
diff --git b/instrumentation/aox/build/clang/server/graph.o a/instrumentation/aox/build/clang/server/graph.o
new file mode 100644
index 0000000..797ddf5
Binary files /dev/null and a/instrumentation/aox/build/clang/server/graph.o differ
diff --git b/instrumentation/aox/build/clang/server/integerset.o a/instrumentation/aox/build/clang/server/integerset.o
new file mode 100644
index 0000000..0e78ad4
Binary files /dev/null and a/instrumentation/aox/build/clang/server/integerset.o differ
diff --git b/instrumentation/aox/build/clang/server/logclient.o a/instrumentation/aox/build/clang/server/logclient.o
new file mode 100644
index 0000000..b4cc1af
Binary files /dev/null and a/instrumentation/aox/build/clang/server/logclient.o differ
diff --git b/instrumentation/aox/build/clang/server/mailbox.o a/instrumentation/aox/build/clang/server/mailbox.o
new file mode 100644
index 0000000..43d7653
Binary files /dev/null and a/instrumentation/aox/build/clang/server/mailbox.o differ
diff --git b/instrumentation/aox/build/clang/server/permissions.o a/instrumentation/aox/build/clang/server/permissions.o
new file mode 100644
index 0000000..d06e3c4
Binary files /dev/null and a/instrumentation/aox/build/clang/server/permissions.o differ
diff --git b/instrumentation/aox/build/clang/server/resolver.o a/instrumentation/aox/build/clang/server/resolver.o
new file mode 100644
index 0000000..41bb01d
Binary files /dev/null and a/instrumentation/aox/build/clang/server/resolver.o differ
diff --git b/instrumentation/aox/build/clang/server/selector.o a/instrumentation/aox/build/clang/server/selector.o
new file mode 100644
index 0000000..ba74d3d
Binary files /dev/null and a/instrumentation/aox/build/clang/server/selector.o differ
diff --git b/instrumentation/aox/build/clang/server/server.o a/instrumentation/aox/build/clang/server/server.o
new file mode 100644
index 0000000..708288a
Binary files /dev/null and a/instrumentation/aox/build/clang/server/server.o differ
diff --git b/instrumentation/aox/build/clang/server/session.o a/instrumentation/aox/build/clang/server/session.o
new file mode 100644
index 0000000..2d390bc
Binary files /dev/null and a/instrumentation/aox/build/clang/server/session.o differ
diff --git b/instrumentation/aox/build/clang/server/timer.o a/instrumentation/aox/build/clang/server/timer.o
new file mode 100644
index 0000000..f580dda
Binary files /dev/null and a/instrumentation/aox/build/clang/server/timer.o differ
diff --git b/instrumentation/aox/build/clang/server/tlsthread.o a/instrumentation/aox/build/clang/server/tlsthread.o
new file mode 100644
index 0000000..067d2ac
Binary files /dev/null and a/instrumentation/aox/build/clang/server/tlsthread.o differ
diff --git b/instrumentation/aox/build/clang/server/user.o a/instrumentation/aox/build/clang/server/user.o
new file mode 100644
index 0000000..2f12ce3
Binary files /dev/null and a/instrumentation/aox/build/clang/server/user.o differ
diff --git b/instrumentation/aox/build/clang/sieve/managesieve.o a/instrumentation/aox/build/clang/sieve/managesieve.o
new file mode 100644
index 0000000..0a2e9f0
Binary files /dev/null and a/instrumentation/aox/build/clang/sieve/managesieve.o differ
diff --git b/instrumentation/aox/build/clang/sieve/managesievecommand.o a/instrumentation/aox/build/clang/sieve/managesievecommand.o
new file mode 100644
index 0000000..0b6e223
Binary files /dev/null and a/instrumentation/aox/build/clang/sieve/managesievecommand.o differ
diff --git b/instrumentation/aox/build/clang/sieve/sieve.o a/instrumentation/aox/build/clang/sieve/sieve.o
new file mode 100644
index 0000000..493ad4b
Binary files /dev/null and a/instrumentation/aox/build/clang/sieve/sieve.o differ
diff --git b/instrumentation/aox/build/clang/sieve/sieveaction.o a/instrumentation/aox/build/clang/sieve/sieveaction.o
new file mode 100644
index 0000000..d9a9d04
Binary files /dev/null and a/instrumentation/aox/build/clang/sieve/sieveaction.o differ
diff --git b/instrumentation/aox/build/clang/sieve/sievenotify.o a/instrumentation/aox/build/clang/sieve/sievenotify.o
new file mode 100644
index 0000000..47ad75a
Binary files /dev/null and a/instrumentation/aox/build/clang/sieve/sievenotify.o differ
diff --git b/instrumentation/aox/build/clang/sieve/sieveparser.o a/instrumentation/aox/build/clang/sieve/sieveparser.o
new file mode 100644
index 0000000..b8994a0
Binary files /dev/null and a/instrumentation/aox/build/clang/sieve/sieveparser.o differ
diff --git b/instrumentation/aox/build/clang/sieve/sieveproduction.o a/instrumentation/aox/build/clang/sieve/sieveproduction.o
new file mode 100644
index 0000000..46fa1dc
Binary files /dev/null and a/instrumentation/aox/build/clang/sieve/sieveproduction.o differ
diff --git b/instrumentation/aox/build/clang/sieve/sievescript.o a/instrumentation/aox/build/clang/sieve/sievescript.o
new file mode 100644
index 0000000..6e4509b
Binary files /dev/null and a/instrumentation/aox/build/clang/sieve/sievescript.o differ
diff --git b/instrumentation/aox/build/clang/smtp/deliveryagent.o a/instrumentation/aox/build/clang/smtp/deliveryagent.o
new file mode 100644
index 0000000..c288164
Binary files /dev/null and a/instrumentation/aox/build/clang/smtp/deliveryagent.o differ
diff --git b/instrumentation/aox/build/clang/smtp/smtp.o a/instrumentation/aox/build/clang/smtp/smtp.o
new file mode 100644
index 0000000..120e767
Binary files /dev/null and a/instrumentation/aox/build/clang/smtp/smtp.o differ
diff --git b/instrumentation/aox/build/clang/smtp/smtpauth.o a/instrumentation/aox/build/clang/smtp/smtpauth.o
new file mode 100644
index 0000000..5eefb42
Binary files /dev/null and a/instrumentation/aox/build/clang/smtp/smtpauth.o differ
diff --git b/instrumentation/aox/build/clang/smtp/smtpcommand.o a/instrumentation/aox/build/clang/smtp/smtpcommand.o
new file mode 100644
index 0000000..9713b95
Binary files /dev/null and a/instrumentation/aox/build/clang/smtp/smtpcommand.o differ
diff --git b/instrumentation/aox/build/clang/smtp/smtpdata.o a/instrumentation/aox/build/clang/smtp/smtpdata.o
new file mode 100644
index 0000000..e54d172
Binary files /dev/null and a/instrumentation/aox/build/clang/smtp/smtpdata.o differ
diff --git b/instrumentation/aox/build/clang/smtp/smtphelo.o a/instrumentation/aox/build/clang/smtp/smtphelo.o
new file mode 100644
index 0000000..026a755
Binary files /dev/null and a/instrumentation/aox/build/clang/smtp/smtphelo.o differ
diff --git b/instrumentation/aox/build/clang/smtp/smtpmailrcpt.o a/instrumentation/aox/build/clang/smtp/smtpmailrcpt.o
new file mode 100644
index 0000000..5b78ba3
Binary files /dev/null and a/instrumentation/aox/build/clang/smtp/smtpmailrcpt.o differ
diff --git b/instrumentation/aox/build/clang/smtp/smtpparser.o a/instrumentation/aox/build/clang/smtp/smtpparser.o
new file mode 100644
index 0000000..3332f8a
Binary files /dev/null and a/instrumentation/aox/build/clang/smtp/smtpparser.o differ
diff --git b/instrumentation/aox/build/clang/smtp/spoolmanager.o a/instrumentation/aox/build/clang/smtp/spoolmanager.o
new file mode 100644
index 0000000..4150550
Binary files /dev/null and a/instrumentation/aox/build/clang/smtp/spoolmanager.o differ
diff --git b/instrumentation/aox/build/gcc-O3/COPYING a/instrumentation/aox/build/gcc-O3/COPYING
new file mode 100644
index 0000000..fc34d88
--- /dev/null
+++ a/instrumentation/aox/build/gcc-O3/COPYING
@@ -0,0 +1,4 @@
+Archiveopteryx 3.2.0 is licensed to you by Oryx Mail Systems GmbH
+under the PostgreSQL License, a copy of which is enclosed in the file
+bsd.txt. We adapted the text from that used by PostgreSQL,
+http://www.postgresql.org/about/licence
diff --git b/instrumentation/aox/build/gcc-O3/README a/instrumentation/aox/build/gcc-O3/README
new file mode 100644
index 0000000..4dc59be
--- /dev/null
+++ a/instrumentation/aox/build/gcc-O3/README
@@ -0,0 +1,131 @@
+Archiveopteryx
+http://archiveopteryx.org
+
+
+See http://archiveopteryx.org/overview for an introduction
+and http://archiveopteryx.org/3.2.0 for information about
+version 3.2.0.
+
+
+Requirements
+------------
+
+You need g++ (and associated packages) to build this software.
+
+You need to have PostgreSQL installed to use Archiveopteryx. We
+recommend the latest 9.x version (but anything newer than 9.1
+should work; see http://archiveopteryx.org/postgresql/).
+
+
+Installation
+------------
+
+For detailed installation instructions, see:
+http://archiveopteryx.org/installation
+
+Here's a brief overview of the steps to follow while installing
+Archiveopteryx for the first time (see below if you're upgrading):
+
+1. Type "make" to compile the software.
+
+   We test the build on Linux and FreeBSD. You may encounter some errors
+   if you compile elsewhere. We make few demands of the platform, so any
+   errors are likely to be minor, and if you tell us about them, we'd be
+   happy to help you resolve them.
+
+2. Type "make install" as root to install the software into /usr/local/archiveopteryx
+   (then switch to that directory to continue).
+
+   The archiveopteryx(7) manual page introduces the software.
+
+   (You may want to add /usr/local/archiveopteryx/man to your MANPATH.)
+
+3. Run "lib/installer" to create a Unix user and group, a PostgreSQL
+   user, the necessary database tables, and to generate an initial
+   configuration file.
+
+   See installer(8) for details, or run "lib/installer -n" to see what
+   commands the installer would run, without running them.
+
+   The generated configuration file should work fine, but you may need
+   to edit it, for example, to enable POP3, or make the servers listen
+   on some interface other than localhost. See archiveopteryx.conf(5)
+   for more details.
+
+4. Start the servers: "bin/aox start".
+
+   aox is the command-line administration tool for Archiveopteryx.
+   See aox(8) or run "bin/aox help" for usage instructions.
+
+   The servers write log output to syslog/mail.
+
+   (To start the servers automatically at boot, use lib/archiveopteryx
+   as an init script.)
+
+5. Create some users, e.g. with:
+
+       bin/aox add user nirmala pwd nirmala@example.com
+
+   Archiveopteryx will create a user named nirmala (with password "pwd")
+   and accept mail sent to the given address, and store it in a mailbox
+   named /users/nirmala/INBOX, which can be accessed via IMAP or POP.
+
+6. Configure your MTA to deliver incoming mail into Archiveopteryx via
+   LMTP (or via bin/deliver, if your MTA doesn't speak LMTP). See, e.g.
+   http://archiveopteryx.org/postfix and .../exim for details.
+
+7. Add an entry to root's crontab to run "aox vacuum" daily. Remember to
+   enable PostgreSQL's "autovacuum" feature too (strongly recommended),
+   or at least to run "vacuumdb -qaz" from the postgres user's crontab.
+   You'll also need to adjust the memory settings in postgresql.conf
+   (shared_buffers, effective_cache_size) for better performance.
+
+
+Upgrading Archiveopteryx
+------------------------
+
+1. "make" and "make install" as above.
+
+2. Upgrade the schema, if necessary: "aox stop; aox upgrade schema"
+
+   We sometimes change the database schema between releases, so you may
+   need to stop the server and upgrade the schema. You can check if the
+   schema is up to date with "aox show schema". The new server will not
+   start until the schema is at the version it expects.
+
+   It is safe to run "aox upgrade schema" when the server is stopped. If
+   it doesn't need to do anything, it will just exit.
+
+   We try to keep schema upgrades fast, to minimise downtime.
+
+3. Restart the servers: "aox restart"
+
+4. Update the database, if necessary: "aox update database"
+
+   Very rarely, we may need to make extensive changes to the database.
+   In this case, you will need to run "aox update database" after you
+   install and start the new server. The server will operate normally
+   as the update proceeds. The release notes for a particular version
+   will always mention it if you need to update the database.
+
+   It is always safe to run "aox update database", whether the server is
+   stopped or running. If it doesn't need to do anything, it will exit.
+   If the process is terminated, it is safe to restart it; it will pick
+   up where it left off.
+
+
+Mailing Lists
+-------------
+
+There are mailing lists for Archiveopteryx users and announcements. To
+subscribe to the users list (which also gets announcements), send mail:
+
+    echo|mail -s subscribe users-request@aox.org
+
+To subscribe instead to the low-volume announcements list:
+
+    echo|mail -s subscribe announce-request@aox.org
+
+
+If you encounter any problems or have any suggestions, please write to
+info@aox.org. Your comments help us improve Archiveopteryx.
diff --git b/instrumentation/aox/build/gcc-O3/downgrades a/instrumentation/aox/build/gcc-O3/downgrades
new file mode 100644
index 0000000..b8c0fed
--- /dev/null
+++ a/instrumentation/aox/build/gcc-O3/downgrades
@@ -0,0 +1,155 @@
+create or replace function downgrade_to_84()
+returns int as $$
+begin
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_83()
+returns int as $$
+begin
+    drop table retention_policies;
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_82()
+returns int as $$
+begin
+    insert into flags (mailbox, uid, flag)
+        select mailbox, uid, (select id from flag_names where name=E'\\\\Seen')
+        from mailbox_messages where seen;
+    insert into flags (mailbox, uid, flag)
+        select mailbox, uid, (select id from flag_names where name=E'\\\\Deleted')
+        from mailbox_messages where deleted;
+    alter table mailbox_messages drop seen, drop deleted;
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_81()
+returns int as $$
+begin
+    drop trigger mailbox_update_trigger on mailboxes;
+    drop function check_mailbox_update();
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_80()
+returns int as $$
+begin
+    drop trigger mailbox_owner_trigger on mailboxes;
+    drop function set_mailbox_owner();
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_85()
+returns int as $$
+begin
+    drop trigger retention_policies_trigger on retention_policies;
+    drop function notify_retention_policies();
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_86()
+returns int as $$
+begin
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_87()
+returns int as $$
+begin
+    alter table users alter alias set not null;
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_88()
+returns int as $$
+begin
+    alter table connections add userid integer;
+    update connections set userid=users.id from users where users.login=connections.username;
+    alter table connections drop username;
+    alter table connections add foreign key(userid) references users(id);
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_89()
+returns int as $$
+begin
+    alter table deliveries drop deliver_after;
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_90()
+returns int as $$
+begin
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_91()
+returns int as $$
+begin
+    alter table connections drop userid;
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_92()
+returns int as $$
+begin
+    alter table users drop quota;
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_93()
+returns int as $$
+begin
+    alter table group_members rename groupid to groupname;
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_94()
+returns int as $$
+begin
+    alter table messages drop thread_root;
+    drop table thread_roots;
+    drop function merge_threads(integer,integer);
+    create table threads (
+        id serial primary key,
+        mailbox integer not null references mailboxes(id),
+        subject text,
+        unique (mailbox, subject)
+    );
+    create table thread_members (
+        thread integer not null references threads(id),
+        mailbox integer not null,
+        uid integer not null,
+        primary key (thread, mailbox, uid),
+        foreign key (mailbox, uid) references mailbox_messages(mailbox, uid)
+            on delete cascade
+    );
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_95()
+returns int as $$
+begin
+    drop index addresses_ldn_key;
+    alter table addresses alter localpart type text;
+    alter table addresses alter domain type text;
+    create unique index addresses_nld_key on addresses(name,localpart,lower(domain));
+    create index ald on addresses(lower(localpart), lower(domain));
+    return 0;
+end;$$ language 'plpgsql';
+
+create or replace function downgrade_to_96()
+returns int as $$
+begin
+    create table views (
+        id          serial primary key,
+        source      integer not null references mailboxes(id)
+                    on delete cascade,
+        view        integer not null references mailboxes(id)
+                    on delete cascade unique,
+        nextmodseq  bigint not null,
+        selector    text
+    );
+    return 0;
+end;$$ language 'plpgsql';
diff --git b/instrumentation/aox/build/gcc-O3/field-names a/instrumentation/aox/build/gcc-O3/field-names
new file mode 100644
index 0000000..dd5aaf3
--- /dev/null
+++ a/instrumentation/aox/build/gcc-O3/field-names
@@ -0,0 +1,32 @@
+insert into field_names (name) values ('From');
+insert into field_names (name) values ('Resent-From');
+insert into field_names (name) values ('Sender');
+insert into field_names (name) values ('Resent-Sender');
+insert into field_names (name) values ('Return-Path');
+insert into field_names (name) values ('Reply-To');
+insert into field_names (name) values ('To');
+insert into field_names (name) values ('Cc');
+insert into field_names (name) values ('Bcc');
+insert into field_names (name) values ('Resent-To');
+insert into field_names (name) values ('Resent-Cc');
+insert into field_names (name) values ('Resent-Bcc');
+insert into field_names (name) values ('Message-Id');
+insert into field_names (name) values ('Resent-Message-Id');
+insert into field_names (name) values ('In-Reply-To');
+insert into field_names (name) values ('References');
+insert into field_names (name) values ('Date');
+insert into field_names (name) values ('Orig-Date');
+insert into field_names (name) values ('Resent-Date');
+insert into field_names (name) values ('Subject');
+insert into field_names (name) values ('Comments');
+insert into field_names (name) values ('Keywords');
+insert into field_names (name) values ('Content-Type');
+insert into field_names (name) values ('Content-Transfer-Encoding');
+insert into field_names (name) values ('Content-Disposition');
+insert into field_names (name) values ('Content-Description');
+insert into field_names (name) values ('Content-Id');
+insert into field_names (name) values ('Mime-Version');
+insert into field_names (name) values ('Received');
+insert into field_names (name) values ('Content-Language');
+insert into field_names (name) values ('Content-Location');
+insert into field_names (name) values ('Content-Md5');
diff --git b/instrumentation/aox/build/gcc-O3/flag-names a/instrumentation/aox/build/gcc-O3/flag-names
new file mode 100644
index 0000000..7418b77
--- /dev/null
+++ a/instrumentation/aox/build/gcc-O3/flag-names
@@ -0,0 +1,5 @@
+insert into flag_names (name) values (E'\\\\Deleted');
+insert into flag_names (name) values (E'\\\\Answered');
+insert into flag_names (name) values (E'\\\\Flagged');
+insert into flag_names (name) values (E'\\\\Draft');
+insert into flag_names (name) values (E'\\\\Seen');
diff --git b/instrumentation/aox/build/gcc-O3/fts.pg a/instrumentation/aox/build/gcc-O3/fts.pg
new file mode 100644
index 0000000..209ecd4
--- /dev/null
+++ a/instrumentation/aox/build/gcc-O3/fts.pg
@@ -0,0 +1,60 @@
+-- There are a couple of things you need to do manually:
+--
+--     1. psql archiveopteryx -f contrib/tsearch2.sql
+--     2. createlang plpgsql archiveopteryx
+--     3. Find out what your current locale is (e.g. "show lc_ctype")
+--        and execute the following statement (assuming a locale of
+--        'en_US.UTF-8'):
+--
+--        update pg_ts_cfg set locale='en_US.UTF-8' where \\
+--        ts_name='default';
+--
+-- The remainder of the script may then be executed with psql -f fts.pg.
+
+
+-- Allow Archiveopteryx to use tsearch2.
+
+grant select on pg_ts_dict to aox;
+grant select on pg_ts_parser to aox;
+grant select on pg_ts_cfg to aox;
+grant select on pg_ts_cfgmap to aox;
+
+
+-- Create a new GiST index on bodyparts.text, and a trigger to update
+-- the index every time a new entry is inserted.
+
+alter table bodyparts add ftidx tsvector;
+update bodyparts set ftidx=to_tsvector('default',text) where length(text) < 1048576;
+create index bodyparts_ftidx on bodyparts using gist(ftidx);
+vacuum full analyze bodyparts;
+
+create trigger bodyparts_ftupdate before insert on bodyparts
+for each row execute procedure tsearch2(ftidx, text);
+
+
+-- XXX: The following code is disabled, because we use copy ... binary
+-- to populate header_fields, and there's no binary input function for
+-- the tsvector type. Do we have to use INSERT if we're running with
+-- db = postgres+tsearch2? If so, perhaps we can use COPY on structured
+-- and INSERT on unstructured fields?
+--
+-- Create a new GiST index on header_fields.value for Subject fields,
+-- and a trigger to update the index every time a new Subject field
+-- is inserted.
+--
+-- alter table header_fields add subjectidx tsvector;
+-- update header_fields set subjectidx=to_tsvector('default',value) where field=20;
+-- create index hf_subjectidx on header_fields using gist(subjectidx) where field=20;
+-- vacuum full analyze header_fields;
+--
+-- create function tsearch2_subject() returns trigger as $$
+-- begin
+--     if NEW.field = 20 then
+--         perform tsearch2(NEW.subjectidx, NEW.value);
+--     end if;
+--     return NEW;
+-- end;
+-- $$ language plpgsql;
+--
+-- create trigger hf_ftupdate before insert on header_fields
+-- for each row execute procedure tsearch2_subject();
diff --git b/instrumentation/aox/build/gcc-O3/license.txt a/instrumentation/aox/build/gcc-O3/license.txt
new file mode 100644
index 0000000..c70c380
--- /dev/null
+++ a/instrumentation/aox/build/gcc-O3/license.txt
@@ -0,0 +1,18 @@
+Copyright (c) 2003-2014, Archiveopteryx and its contributors.
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose, without fee, and without a written
+agreement is hereby granted, provided that the above copyright notice
+and this paragraph and the following two paragraphs appear in all
+copies.
+
+IN NO EVENT SHALL ORYX BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+ORYX HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ORYX SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
+BASIS, AND ORYX HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
diff --git b/instrumentation/aox/build/gcc-O3/schema.pg a/instrumentation/aox/build/gcc-O3/schema.pg
new file mode 100644
index 0000000..6486eeb
--- /dev/null
+++ a/instrumentation/aox/build/gcc-O3/schema.pg
@@ -0,0 +1,561 @@
+-- See http://archiveopteryx.org/db/ for documentation.
+
+-- Each table is documented in an eponymous /db/ page. For example,
+-- http://archiveopteryx.org/db/addresses describes the addresses
+-- table.
+
+-- Finally, http://archiveopteryx.org/schema is a quick overview.
+
+
+-- This table contains information internal to the mailstore.
+-- For now, its only purpose is to coordinate schema updates.
+
+create table mailstore (
+    -- Grant: select, update
+    revision    integer not null primary key
+);
+insert into mailstore (revision) values (97);
+
+
+-- One entry for each unique address we've encountered.
+
+create extension if not exists citext;
+create table addresses (
+    -- Grant: select, insert
+    id          serial primary key,
+    name        text,
+    localpart   citext,
+    domain      citext
+);
+create unique index addresses_ldn_key on addresses(localpart,domain,name);
+
+
+-- One entry per "other users" namespace. Personal namespaces are
+-- implicitly created within these.
+
+create table namespaces (
+    id          serial primary key,
+    name        text not null unique
+);
+insert into namespaces (name) values ('/users');
+
+
+-- One entry per Archiveopteryx user. Used for authentication.
+
+create table users (
+    id          serial primary key,
+    login       text,
+    secret      text,
+    ldapdn      text,
+    parentspace integer not null references namespaces(id),
+    quota       bigint not null default 2147483647
+);
+create unique index u_l on users (lower(login));
+
+
+-- One entry per group of users.
+
+create table groups (
+    id          serial primary key,
+    name        text
+);
+
+
+-- One entry for each group member.
+
+create table group_members (
+    groupid     integer not null references groups(id),
+    member      integer not null references users(id),
+    primary key (groupid, member)
+);
+
+
+-- One entry per deliverable mailbox.
+
+create table mailboxes (
+    -- Grant: select, insert, update
+    id          serial primary key,
+    name        text not null unique,
+    owner       integer references users(id),
+
+    -- The UID that will be assigned to the next delivered message.
+    -- Incremented after each successful delivery.
+    uidnext     integer not null default 1,
+
+    -- The next modsequence value for this mailbox.
+    nextmodseq  bigint not null default 1,
+
+    -- The UID of the first message that should be marked \\Recent.
+    -- Set to uidnext when each new IMAP session is created.
+    first_recent integer not null default 1,
+
+    -- The IMAP mailbox UIDVALIDITY value, which, along with a message UID,
+    -- is forever guaranteed to uniquely refer to a single message.
+    uidvalidity integer not null default 1,
+
+    -- When a mailbox is deleted, its entry is marked (not removed), so
+    -- that its UIDVALIDITY can be incremented if it is ever re-created.
+    deleted     boolean not null default false
+);
+
+
+-- When aoximport or others create /users/foo/bar, bar needs to own
+-- the mailbox, so ensure that that happens.
+
+create function set_mailbox_owner() returns trigger as $$
+begin
+    if new.owner is null then
+    select into new.owner u.id
+        from users u join namespaces n on (u.parentspace=n.id)
+        where new.name like n.name||'/'||u.login||'/%'
+        or new.name = n.name||'/'||u.login limit 1;
+    end if;
+    return new;
+end;
+$$ language 'plpgsql';
+
+create trigger mailbox_owner_trigger
+before insert on mailboxes for each
+row execute procedure set_mailbox_owner();
+
+-- Ensure that mailboxes cannot be deleted while something relies on
+-- their existence
+
+create function check_mailbox_update() returns trigger as $$
+declare address text;
+begin
+    notify mailboxes_updated;
+    if new.deleted='t' and old.deleted='f' then
+        perform * from mailbox_messages where mailbox=new.id;
+        if found then
+            raise exception '% is not empty', new.name;
+        end if;
+        select a.localpart||'@'||a.domain into address
+            from addresses a join aliases al on (a.id=al.address)
+            where al.mailbox=new.id;
+        if address is not null then
+            raise exception '% used by alias %', new.name, address;
+        end if;
+        perform * from fileinto_targets where mailbox=new.id;
+        if found then
+            raise exception '% is used by sieve fileinto', new.name;
+        end if;
+    end if;
+    return new;
+end;
+$$ language 'plpgsql';
+
+create trigger mailbox_update_trigger
+before update on mailboxes for each
+row execute procedure check_mailbox_update();
+
+
+-- One entry per delivery alias: mail to the given address should be
+-- accepted and delivered into the given mailbox.
+
+create table aliases (
+    -- Grant: select, update
+    id          serial primary key,
+    address     integer not null unique references addresses(id),
+    mailbox     integer not null references mailboxes(id)
+                on delete cascade
+);
+
+
+alter table users add alias integer references aliases(id);
+
+
+-- One row per <identifier, rights> entry for a mailbox.
+
+create table permissions (
+    -- Grant: select, insert, delete, update
+    mailbox     integer not null references mailboxes(id),
+    identifier  text not null,
+    rights      text not null,
+    primary key (mailbox, identifier)
+);
+
+
+-- One entry for each Message-ID that begins a thread (for THREAD=REFS)
+
+create table thread_roots (
+    -- Grant: select, insert, update
+    id          serial primary key,
+    messageid   text not null unique
+);
+
+
+-- One entry per message stored
+
+create table messages (
+    -- Grant: select, insert
+    id          serial primary key,
+    idate       integer not null,
+    rfc822size  integer,
+    thread_root integer references thread_roots(id)
+);
+
+
+-- One (mailbox, uid) entry per message and mailbox.
+
+create table mailbox_messages (
+    -- Grant: select, insert, update
+    mailbox     integer not null references mailboxes(id),
+    uid         integer not null,
+    message     integer not null references messages(id),
+    modseq      bigint not null,
+    seen        boolean not null default false,
+    deleted     boolean not null default false,
+    primary key (mailbox, uid)
+);
+
+create index mm_m on mailbox_messages(message);
+
+
+-- One entry for the text of each unique MIME body part.
+-- Entries here may be shared by more than one message.
+
+create sequence bodypart_ids;
+create table bodyparts (
+    -- Grant: select, insert
+    id          integer default nextval('bodypart_ids') primary key,
+    bytes       integer not null,
+    hash        text not null,
+    text        text,
+    data        bytea
+);
+create index b_h on bodyparts(hash);
+
+
+-- One entry for each bodypart in a message.
+
+create table part_numbers (
+    -- Grant: select, insert
+    message     integer references messages(id) on delete cascade,
+    part        text not null,
+    bodypart    integer references bodyparts(id),
+    bytes       integer,
+    lines       integer,
+    primary key (message, part)
+);
+create index pn_b on part_numbers(bodypart);
+
+
+-- One entry for each field name we've seen (From, To, Subject, etc.).
+-- (This table is partially populated from the field-names file.)
+
+create table field_names (
+    -- Grant: select, insert
+    id          serial primary key,
+    name        text unique
+);
+
+
+-- One entry for each header field in a message, except address fields.
+
+create table header_fields (
+    -- Grant: select, insert
+    id          serial primary key,
+    message     integer not null,
+    part        text not null,
+    position    integer not null,
+    field       integer not null references field_names(id),
+    value       text,
+    unique (message, part, position, field),
+    foreign key (message, part)
+                references part_numbers(message, part)
+                on delete cascade
+);
+
+create index hf_msgid on header_fields(value) where field=13;
+
+
+-- One entry for each address associated with a message. Address
+-- fields are stored as one or more row here.
+
+create table address_fields (
+    -- Grant: select, insert
+    message     integer not null,
+    part        text not null,
+    position    integer not null,
+    field       integer not null,
+    number      integer,
+    address     integer not null references addresses(id),
+    foreign key (message, part)
+                references part_numbers(message, part)
+                on delete cascade
+);
+create index af_mp on address_fields (message, part);
+
+
+-- The Date field from each message.
+
+create table date_fields (
+    -- Grant: select, insert
+    message     integer not null references messages(id)
+                on delete cascade,
+    value       timestamp with time zone
+);
+
+create index df_m on date_fields(message);
+
+
+-- One entry per user-defined flag name to be used in flags.
+
+create table flag_names (
+    -- Grant: select, insert
+    id          serial primary key,
+    name        text
+);
+create unique index fn_uname on flag_names(lower(name));
+
+
+-- One entry per user-defined IMAP message flag per message.
+
+create table flags (
+    -- Grant: select, insert, delete
+    mailbox     integer not null,
+    uid         integer not null,
+    flag        integer not null references flag_names(id),
+    foreign key (mailbox, uid)
+                references mailbox_messages(mailbox, uid)
+                on delete cascade
+);
+create index fl_mu on flags (mailbox, uid);
+
+
+-- One entry per subscribed mailbox per user.
+
+create table subscriptions (
+    -- Grant: select, insert, delete
+    id          serial primary key,
+    owner       integer not null references users(id)
+                on delete cascade,
+    mailbox     integer not null references mailboxes(id),
+    unique(owner, mailbox)
+);
+
+
+-- One entry per vendor- or RFC-defined name to be used in annotations.
+
+create table annotation_names (
+    -- Grant: select, insert
+    id          serial primary key,
+    name        text unique
+);
+
+
+-- One entry per annotation.
+
+create table annotations (
+    -- Grant: select, insert, delete, update
+    id          serial primary key,
+    mailbox     integer not null,
+    uid         integer not null,
+    owner       integer references users(id) on delete cascade,
+    name        integer not null references annotation_names(id),
+    value       text,
+    unique (mailbox, uid, owner, name),
+    foreign key (mailbox, uid)
+                references mailbox_messages(mailbox, uid)
+                on delete cascade
+);
+
+
+-- One entry per SIEVE script owned by a user.
+
+create table scripts (
+    -- Grant: select, insert, delete, update
+    id          serial primary key,
+    owner       integer not null references users(id)
+                on delete cascade,
+    name        text,
+    active      boolean not null default 'f',
+    script      text,
+    unique (owner, name)
+);
+
+
+-- One entry per deleted (EXPUNGEd) message. A row here says "message
+-- #n used to be (mailbox,uid) until it was deleted_by ... at ...". A
+-- given pair of (mailbox,uid) may exist either in mailbox_messages or
+-- here, never in both.
+
+create table deleted_messages (
+    -- Grant: select, insert
+    mailbox     integer not null references mailboxes(id),
+    uid         integer not null,
+    message     integer not null references messages(id)
+                on delete cascade,
+    modseq      bigint not null,
+    deleted_by  integer references users(id),
+    deleted_at  timestamp with time zone not null
+                default current_timestamp,
+    reason      text,
+    primary key (mailbox, uid)
+);
+
+create index dm_mud on deleted_messages(mailbox,uid,deleted_at);
+create index dm_mm on deleted_messages(mailbox,modseq);
+create index dm_m on deleted_messages(message);
+
+
+-- When an entry is inserted into deleted_messages, we delete the
+-- corresponding row from mailbox_messages.
+
+create function delete_message() returns trigger as $$
+begin
+    delete from mailbox_messages where mailbox=NEW.mailbox and uid=NEW.uid;
+    return NULL;
+end;
+$$ language plpgsql security definer;
+
+create trigger deleted_messages_trigger
+after insert on deleted_messages
+for each row execute procedure delete_message();
+
+-- One entry for each pending SMTP-submitted delivery.
+
+create table deliveries (
+    -- Grant: select, insert, delete, update
+    id          serial primary key,
+    sender      integer not null references addresses(id),
+    message     integer not null references messages(id)
+                on delete cascade
+                unique,
+    injected_at timestamp with time zone,
+    expires_at  timestamp with time zone,
+    deliver_after timestamp with time zone
+);
+
+
+-- One entry for each recipient of pending outgoing mail.
+
+create table delivery_recipients (
+    -- Grant: select, insert, update
+    id          serial primary key,
+    delivery    integer not null references deliveries(id)
+                on delete cascade,
+    recipient   integer not null references addresses(id),
+    last_attempt timestamp with time zone,
+    action      integer not null default 0,
+    status      text
+);
+
+
+-- Each entry contains a single user's access key to a given mailbox.
+-- (See URLAUTH, RFC 4467.)
+
+create table access_keys (
+    -- Grant: select, insert, delete
+    userid      integer not null references users(id)
+                on delete cascade,
+    mailbox     integer not null references mailboxes(id)
+                on delete cascade,
+    key         text not null,
+    primary key (userid, mailbox)
+);
+
+
+-- One entry for each bodypart that represents an unparseable message
+-- that was wrapped as an application/octet-stream.
+
+create table unparsed_messages (
+    -- Grant: insert
+    bodypart    integer not null references bodyparts(id)
+                on delete cascade,
+    primary key(bodypart)
+);
+
+
+-- One entry for every autoresponse we send.
+
+create table autoresponses (
+    -- Grant: select, insert
+    id          serial primary key,
+    sent_from   integer not null references addresses(id),
+    sent_to     integer not null references addresses(id),
+    expires_at  timestamp with time zone not null
+                default current_timestamp+interval '7 days',
+    handle      text
+);
+
+
+-- One entry for every (authenticated) connection made to any of the
+-- servers.
+
+create table connections (
+    -- Grant: insert
+    id          serial primary key,
+    userid      integer,
+    username    text,
+    address     inet not null,
+    port        integer not null,
+    mechanism   varchar not null,
+    authfailures integer not null,
+    syntaxerrors integer not null,
+    started_at  timestamp with time zone not null,
+    ended_at    timestamp with time zone not null
+);
+
+
+-- One entry for each mailbox used by a given script as a target for a
+-- "fileinto". These mailboxes must not be deleted, since that would
+-- cause the referring script to fail.
+
+create table fileinto_targets (
+    -- Grant: select, insert, delete
+    id          serial primary key,
+    script      integer not null references scripts(id)
+                on delete cascade,
+    mailbox     integer not null references mailboxes(id),
+    unique(script, mailbox)
+);
+
+
+-- One entry for each message that a poor misguided Exchange/Outlook
+-- contributes to its idea of a thread. Used to turn E/O threading
+-- into what the rest of the universe uses.
+
+create table thread_indexes (
+    -- Grant: select, insert
+    message     integer not null references messages(id)
+                on delete cascade,
+    thread_index text
+);
+
+create index ti_outlook_hack on thread_indexes(thread_index);
+
+
+-- One row for each explicit retention policy defined by the
+-- administrator.
+
+create table retention_policies (
+    id          serial primary key,
+    action      text not null,
+    mailbox     integer references mailboxes(id),
+    duration    integer not null,
+    selector    text,
+    constraint rp_action check (action in ('retain','delete'))
+);
+
+create or replace function notify_retention_policies()
+returns trigger as $$
+begin
+    notify retention_policies_updated;
+    return NULL;
+end;$$ language 'plpgsql';
+
+create trigger retention_policies_trigger
+after insert or update or delete
+on retention_policies
+for each statement
+execute procedure notify_retention_policies();
+
+create or replace function merge_threads(t integer, f integer) returns int as $$
+begin
+    -- Grant: execute
+    update messages set thread_root=t where thread_root=f;
+    return 0;
+end;
+$$ language 'plpgsql' security definer;
diff --git b/hung_patch_from_arnt/aox/core/allocator.cpp a/instrumentation/aox/core/allocator.cpp
index 42c6a50..8571074 100644
--- b/hung_patch_from_arnt/aox/core/allocator.cpp
+++ a/instrumentation/aox/core/allocator.cpp
@@ -432,7 +432,7 @@ void Allocator::deallocate( void * p )
     random binary data.
 
     Scanning long strings is slow. Binary data can give false alarms
-    during pointer scanning, which will lead to memory not being
+    during pointer scanning, which will lead ot memory not being
     freed.
 */
 
@@ -533,8 +533,8 @@ void Allocator::mark()
 }
 
 
-/*! Frees all memory that's no longer in use. This can take some time.
-
+/*! Frees all memory that's no longer in use. This can take some time. 
+ 
     Returns null if entries is null or empty, returns an object in
     entries else. The returned object is (in some sense) the one
     that's responsible for the largest share of allocated memory.
@@ -558,7 +558,7 @@ Garbage * Allocator::free( List<Garbage> * entries )
     uint freed = 0;
     objects = 0;
     ::marked = 0;
-
+    
     Garbage * biggest = 0;
 
     // mark
@@ -918,7 +918,7 @@ void pointers( void * p )
                                 if ( m->payload[n] == p ) {
                                     fprintf( stderr,
                                              "Pointer at 0x%p (in 0x%p, "
-                                             "size <= %d, %u pointers)\\n",
+                                             "size <= %d, %d pointers)\\n",
                                              &m->payload[n],
                                              &m->payload[0],
                                              a->step - bytes,
diff --git b/hung_patch_from_arnt/aox/core/estring.cpp a/instrumentation/aox/core/estring.cpp
index 2c8659f..6f0d394 100644
--- b/hung_patch_from_arnt/aox/core/estring.cpp
+++ a/instrumentation/aox/core/estring.cpp
@@ -946,15 +946,7 @@ uint EString::number( bool * ok, uint base ) const
 EString EString::fromNumber( int64 n, uint base )
 {
     EString r;
-    if (0 == n) {
-        r.append("0");        // Short-circuit, 0 is 0 in any base, no need for extra processing
-    } else {
-        if (n < 0) {
-            n = -n;        // Negate, otherwise negative numbers get messed up
-            r.append("-");    // But we remember we need a - sign
-        }
-        r.appendNumber( n, base );
-    }
+    r.appendNumber( n, base );
     return r;
 }
 
diff --git b/instrumentation/aox/db/downgrades.inc a/instrumentation/aox/db/downgrades.inc
new file mode 100644
index 0000000..7a6212b
--- /dev/null
+++ a/instrumentation/aox/db/downgrades.inc
@@ -0,0 +1,259 @@
+static uint numDowngradeFunctions = 97;
+static const char * downgradeFunctions[98] = {
+    0, // 0 undefined
+    0, // 1 undefined
+    0, // 2 undefined
+    0, // 3 undefined
+    0, // 4 undefined
+    0, // 5 undefined
+    0, // 6 undefined
+    0, // 7 undefined
+    0, // 8 undefined
+    0, // 9 undefined
+    0, // 10 undefined
+    0, // 11 undefined
+    0, // 12 undefined
+    0, // 13 undefined
+    0, // 14 undefined
+    0, // 15 undefined
+    0, // 16 undefined
+    0, // 17 undefined
+    0, // 18 undefined
+    0, // 19 undefined
+    0, // 20 undefined
+    0, // 21 undefined
+    0, // 22 undefined
+    0, // 23 undefined
+    0, // 24 undefined
+    0, // 25 undefined
+    0, // 26 undefined
+    0, // 27 undefined
+    0, // 28 undefined
+    0, // 29 undefined
+    0, // 30 undefined
+    0, // 31 undefined
+    0, // 32 undefined
+    0, // 33 undefined
+    0, // 34 undefined
+    0, // 35 undefined
+    0, // 36 undefined
+    0, // 37 undefined
+    0, // 38 undefined
+    0, // 39 undefined
+    0, // 40 undefined
+    0, // 41 undefined
+    0, // 42 undefined
+    0, // 43 undefined
+    0, // 44 undefined
+    0, // 45 undefined
+    0, // 46 undefined
+    0, // 47 undefined
+    0, // 48 undefined
+    0, // 49 undefined
+    0, // 50 undefined
+    0, // 51 undefined
+    0, // 52 undefined
+    0, // 53 undefined
+    0, // 54 undefined
+    0, // 55 undefined
+    0, // 56 undefined
+    0, // 57 undefined
+    0, // 58 undefined
+    0, // 59 undefined
+    0, // 60 undefined
+    0, // 61 undefined
+    0, // 62 undefined
+    0, // 63 undefined
+    0, // 64 undefined
+    0, // 65 undefined
+    0, // 66 undefined
+    0, // 67 undefined
+    0, // 68 undefined
+    0, // 69 undefined
+    0, // 70 undefined
+    0, // 71 undefined
+    0, // 72 undefined
+    0, // 73 undefined
+    0, // 74 undefined
+    0, // 75 undefined
+    0, // 76 undefined
+    0, // 77 undefined
+    0, // 78 undefined
+    0, // 79 undefined
+
+// step to 80
+    "create or replace function downgrade_to_80()"
+    "returns int as $$"
+    "begin"
+    "    drop trigger mailbox_owner_trigger on mailboxes;"
+    "    drop function set_mailbox_owner();"
+    "    return 0;"
+    "end;$$ language 'plpgsql'",
+
+// step to 81
+    "create or replace function downgrade_to_81()"
+    "returns int as $$"
+    "begin"
+    "    drop trigger mailbox_update_trigger on mailboxes;"
+    "    drop function check_mailbox_update();"
+    "    return 0;"
+    "end;$$ language 'plpgsql'",
+
+// step to 82
+    "create or replace function downgrade_to_82()"
+    "returns int as $$"
+    "begin"
+    "    insert into flags (mailbox, uid, flag)"
+    "        select mailbox, uid, (select id from flag_names where name=E'\\\\Seen')"
+    "        from mailbox_messages where seen;"
+    "    insert into flags (mailbox, uid, flag)"
+    "        select mailbox, uid, (select id from flag_names where name=E'\\\\Deleted')"
+    "        from mailbox_messages where deleted;"
+    "    alter table mailbox_messages drop seen, drop deleted;"
+    "    return 0;"
+    "end;$$ language 'plpgsql'",
+
+// step to 83
+    "create or replace function downgrade_to_83()"
+    "returns int as $$"
+    "begin"
+    "    drop table retention_policies;"
+    "    return 0;"
+    "end;$$ language 'plpgsql'",
+
+// step to 84
+    "create or replace function downgrade_to_84()"
+    "returns int as $$"
+    "begin"
+    "    return 0;"
+    "end;$$ language 'plpgsql'",
+
+// step to 85
+    "create or replace function downgrade_to_85()"
+    "returns int as $$"
+    "begin"
+    "    drop trigger retention_policies_trigger on retention_policies;"
+    "    drop function notify_retention_policies();"
+    "    return 0;"
+    "end;$$ language 'plpgsql'",
+
+// step to 86
+    "create or replace function downgrade_to_86()"
+    "returns int as $$"
+    "begin"
+    "    return 0;"
+    "end;$$ language 'plpgsql'",
+
+// step to 87
+    "create or replace function downgrade_to_87()"
+    "returns int as $$"
+    "begin"
+    "    alter table users alter alias set not null;"
+    "    return 0;"
+    "end;$$ language 'plpgsql'",
+
+// step to 88
+    "create or replace function downgrade_to_88()"
+    "returns int as $$"
+    "begin"
+    "    alter table connections add userid integer;"
+    "    update connections set userid=users.id from users where users.login=connections.username;"
+    "    alter table connections drop username;"
+    "    alter table connections add foreign key(userid) references users(id);"
+    "    return 0;"
+    "end;$$ language 'plpgsql'",
+
+// step to 89
+    "create or replace function downgrade_to_89()"
+    "returns int as $$"
+    "begin"
+    "    alter table deliveries drop deliver_after;"
+    "    return 0;"
+    "end;$$ language 'plpgsql'",
+
+// step to 90
+    "create or replace function downgrade_to_90()"
+    "returns int as $$"
+    "begin"
+    "    return 0;"
+    "end;$$ language 'plpgsql'",
+
+// step to 91
+    "create or replace function downgrade_to_91()"
+    "returns int as $$"
+    "begin"
+    "    alter table connections drop userid;"
+    "    return 0;"
+    "end;$$ language 'plpgsql'",
+
+// step to 92
+    "create or replace function downgrade_to_92()"
+    "returns int as $$"
+    "begin"
+    "    alter table users drop quota;"
+    "    return 0;"
+    "end;$$ language 'plpgsql'",
+
+// step to 93
+    "create or replace function downgrade_to_93()"
+    "returns int as $$"
+    "begin"
+    "    alter table group_members rename groupid to groupname;"
+    "    return 0;"
+    "end;$$ language 'plpgsql'",
+
+// step to 94
+    "create or replace function downgrade_to_94()"
+    "returns int as $$"
+    "begin"
+    "    alter table messages drop thread_root;"
+    "    drop table thread_roots;"
+    "    drop function merge_threads(integer,integer);"
+    "    create table threads ("
+    "        id serial primary key,"
+    "        mailbox integer not null references mailboxes(id),"
+    "        subject text,"
+    "        unique (mailbox, subject)"
+    "    );"
+    "    create table thread_members ("
+    "        thread integer not null references threads(id),"
+    "        mailbox integer not null,"
+    "        uid integer not null,"
+    "        primary key (thread, mailbox, uid),"
+    "        foreign key (mailbox, uid) references mailbox_messages(mailbox, uid)"
+    "            on delete cascade"
+    "    );"
+    "    return 0;"
+    "end;$$ language 'plpgsql'",
+
+// step to 95
+    "create or replace function downgrade_to_95()"
+    "returns int as $$"
+    "begin"
+    "    drop index addresses_ldn_key;"
+    "    alter table addresses alter localpart type text;"
+    "    alter table addresses alter domain type text;"
+    "    create unique index addresses_nld_key on addresses(name,localpart,lower(domain));"
+    "    create index ald on addresses(lower(localpart), lower(domain));"
+    "    return 0;"
+    "end;$$ language 'plpgsql'",
+
+// step to 96
+    "create or replace function downgrade_to_96()"
+    "returns int as $$"
+    "begin"
+    "    create table views ("
+    "        id          serial primary key,"
+    "        source      integer not null references mailboxes(id)"
+    "                    on delete cascade,"
+    "        view        integer not null references mailboxes(id)"
+    "                    on delete cascade unique,"
+    "        nextmodseq  bigint not null,"
+    "        selector    text"
+    "    );"
+    "    return 0;"
+    "end;$$ language 'plpgsql'",
+
+// dummy final entry
+    0
+};
diff --git b/instrumentation/aox/db/privileges.inc a/instrumentation/aox/db/privileges.inc
new file mode 100644
index 0000000..b96724d
--- /dev/null
+++ a/instrumentation/aox/db/privileges.inc
@@ -0,0 +1,35 @@
+    { "mailstore", true, false, true, false },
+    { "addresses", true, true, false, false },
+    { "namespaces", true, false, false, false },
+    { "users", true, false, false, false },
+    { "groups", true, false, false, false },
+    { "group_members", true, false, false, false },
+    { "mailboxes", true, true, true, false },
+    { "aliases", true, false, true, false },
+    { "permissions", true, true, true, true },
+    { "thread_roots", true, true, true, false },
+    { "messages", true, true, false, false },
+    { "mailbox_messages", true, true, true, false },
+    { "bodyparts", true, true, false, false },
+    { "part_numbers", true, true, false, false },
+    { "field_names", true, true, false, false },
+    { "header_fields", true, true, false, false },
+    { "address_fields", true, true, false, false },
+    { "date_fields", true, true, false, false },
+    { "flag_names", true, true, false, false },
+    { "flags", true, true, false, true },
+    { "subscriptions", true, true, false, true },
+    { "annotation_names", true, true, false, false },
+    { "annotations", true, true, true, true },
+    { "scripts", true, true, true, true },
+    { "deleted_messages", true, true, false, false },
+    { "deliveries", true, true, true, true },
+    { "delivery_recipients", true, true, true, false },
+    { "access_keys", true, true, false, true },
+    { "unparsed_messages", false, true, false, false },
+    { "autoresponses", true, true, false, false },
+    { "connections", false, true, false, false },
+    { "fileinto_targets", true, true, false, true },
+    { "thread_indexes", true, true, false, false },
+    { "retention_policies", true, false, false, false },
+    { "retention_policies", false, false, false, false },
diff --git b/hung_patch_from_arnt/aox/db/query.cpp a/instrumentation/aox/db/query.cpp
index 85f7aae..966e495 100644
--- b/hung_patch_from_arnt/aox/db/query.cpp
+++ a/instrumentation/aox/db/query.cpp
@@ -562,7 +562,7 @@ void Query::notify()
     try {
         d->owner->execute();
     }
-    catch ( const Exception& e ) {
+    catch ( Exception e ) {
         d->owner = 0; // so we can't get close to a segfault again
         if ( e == Invariant ) {
             setError( "Invariant failed while processing Query::notify()" );
@@ -599,7 +599,7 @@ void Query::notify()
             }
         }
         else {
-            throw;
+            throw e;
         }
     }
 }
diff --git b/hung_patch_from_arnt/aox/db/transaction.cpp a/instrumentation/aox/db/transaction.cpp
index 73bab8d..a85a7b5 100644
--- b/hung_patch_from_arnt/aox/db/transaction.cpp
+++ a/instrumentation/aox/db/transaction.cpp
@@ -609,7 +609,7 @@ void Transaction::notify()
     try {
         d->owner->execute();
     }
-    catch ( const Exception& e ) {
+    catch ( Exception e ) {
         d->owner = 0; // so we can't get close to a segfault again
         if ( e == Invariant ) {
             setError( 0,
@@ -633,7 +633,7 @@ void Transaction::notify()
             }
         }
         else {
-            throw;
+            throw e;
         }
     }
     if ( done() && d->parent &&
diff --git b/instrumentation/aox/doc/man/man5/aoxsuper.conf.5 a/instrumentation/aox/doc/man/man5/aoxsuper.conf.5
new file mode 100644
index 0000000..7b6978f
--- /dev/null
+++ a/instrumentation/aox/doc/man/man5/aoxsuper.conf.5
@@ -0,0 +1,69 @@
+.\\" Copyright 2009 The Archiveopteryx Developers <info@aox.org>
+.TH aoxsuper.conf 5 2014-03-10 aox.org "Archiveopteryx Documentation"
+.SH NAME
+aoxsuper.conf - configuration file for Archiveopteryx.
+.SH SYNOPSIS
+.B /usr/local/archiveopteryx/aoxsuper.conf
+.br
+.SH DESCRIPTION
+.nh
+.PP
+The
+.I aoxsuper.conf
+file contains a few configuration settings for Archiveopteryx. It is read by
+.BR aox (8)
+at startup. Syntax errors, unknown variables,
+and other errors are logged on stderr.
+.PP
+.I aoxsuper.conf
+is usually created at installation time, by running
+.BR /usr/local/archiveopteryx/lib/installer .
+.PP
+There is only one required variable, namely
+.IR db-owner-password .
+.SH "SECURITY NOTE"
+Anyone who can read
+.I aoxsuper.conf
+can see the database owner password, and use this password to read all
+mail, or even to damage or destroy the mail database.
+.PP
+By default,
+.I aoxsuper.conf
+is readable only by root.
+.SH SETTINGS
+.PP
+The format is as for
+.BR archiveopteryx.conf (5):
+.IP
+name = value # comment
+.PP
+All variables in
+.BR archiveopteryx.conf (5)
+may be overridden in
+.IR aoxsuper.conf ,
+if it is necessary that
+.BR aox (8)
+sees a different value than the servers see.
+.SS "Database Access"
+.IP db-owner
+The name of the Postgres user that owns the database and is used to
+perform privileged operations (such as deleting mail). The default is
+.IR aoxsuper .
+.IP db-owner-password
+The database password used for the
+.IR db-owner .
+The default is an empty string.
+.IP
+Unless a password is specified, the Archiveopteryx installer sets up a
+randomly-chosen password and writes it to the configuration file.
+.SH AUTHOR
+The Archiveopteryx Developers, info@aox.org.
+.SH VERSION
+This man page covers Archiveopteryx version 3.2.0, released 2014-03-10,
+http://archiveopteryx.org/3.2.0
+.SH SEE ALSO
+.BR archiveopteryx.conf (5),
+.BR archiveopteryx (8),
+.BR deliver (8),
+.BR logd (8),
+http://archiveopteryx.org
diff --git b/instrumentation/aox/doc/man/man5/archiveopteryx.conf.5 a/instrumentation/aox/doc/man/man5/archiveopteryx.conf.5
new file mode 100644
index 0000000..ac28f1c
--- /dev/null
+++ a/instrumentation/aox/doc/man/man5/archiveopteryx.conf.5
@@ -0,0 +1,615 @@
+.\\" Copyright 2009 The Archiveopteryx Developers <info@aox.org>
+.TH archiveopteryx.conf 5 2014-03-10 aox.org "Archiveopteryx Documentation"
+.SH NAME
+archiveopteryx.conf - configuration file for Archiveopteryx.
+.SH SYNOPSIS
+.B /usr/local/archiveopteryx/archiveopteryx.conf
+.br
+.SH DESCRIPTION
+.nh
+.PP
+The
+.I archiveopteryx.conf
+file contains most global configuration settings for Archiveopteryx. It
+is read by each server at startup. Syntax errors, unknown variables,
+and other errors are logged via
+.BR logd (8).
+.PP
+.I archiveopteryx.conf
+and its sibling
+.BR aoxsuper.conf (5)
+are usually created at installation time, by running
+.BR /usr/local/archiveopteryx/lib/installer .
+.PP
+There is only one required variable, namely
+.IR db-password .
+.SH "SECURITY NOTE"
+Anyone who can read
+.I archiveopteryx.conf
+can see the database user password, and use this password to read all
+mail and in many cases even delete mail.
+.PP
+By default,
+.I archiveopteryx.conf
+is readable only by root.
+.SH SETTINGS
+.PP
+All settings share a common format:
+.IP
+name = value # comment
+.PP
+For the
+.I *-address
+variables, the value may be either a hostname, an IPv4 or IPv6
+address, the fully-qualified path to a Unix socket. For
+.I imap-address
+and a few other variables, the empty string is also allowed, meaning
+"all IPv4/6 addresses of this host".
+.SS "General Settings"
+.IP hostname
+Most of the servers need to know the fully-qualified hostname. The
+default is computed at runtime and is normally acceptable.
+.IP
+Note that if the name is "localhost", there may be problems with
+TLS. An IMAP/POP/SMTP client may refuse a server certificate for
+"localhost" if it already has seen a different certificate for
+"localhost". We strongly suggest using a different
+.IR hostname .
+.IP use-ipv4
+decides whether the various servers accept IPv4 connections.
+.I true
+by default.
+.IP use-ipv6
+decides whether the various servers accept IPv6 connections.
+.I true
+by default.
+.IP undelete-time
+is the number of days a message can be undeleted after being deleted,
+.I 49
+by default.
+.IP server-processes
+is the number of processes started to serve IMAP/POP clients. This is
+.I 2
+by default.
+.IP
+The
+.I server-processes
+setting should be about as large as the number of CPU cores available,
+perhaps a little larger. We advise asking info@aox.org in unusual
+cases.
+.SS "Database Access"
+.IP db
+The type of database. The default,
+.IR postgres ,
+is currently the only supported value.
+.IP db-address
+The address of the database server. The default is
+.IR 127.0.0.1 .
+.IP db-port
+The port number of the database server. The default is
+.IR 5432 .
+.IP db-name
+The name of the database to use. The default is
+.IR archiveopteryx .
+.IP db-schema
+The name of the schema in the database where the database objects are
+installed. The default is
+.IR public .
+It is safe to ignore this setting.
+.IP db-user
+The name of the unprivileged Postgres user that the servers ordinarily
+use. The default is
+.IR aox .
+.IP db-password
+The database password used for the
+.IR db-user .
+The default is an empty string.
+.IP
+Unless a password is specified, Archiveopteryx sets up a randomly-chosen
+password and writes it to the configuration file during installation.
+.IP db-max-handles
+The maximum number of database handles that Archiveopteryx may open. The
+default is
+.IR 4 .
+.IP
+The server creates one handle at startup, and may create others if the
+load justifies it (and as controlled by
+.IR db-handle-interval ).
+Note, however, that when running with
+.IR security=on ,
+new database handles can be created only if you connect to the server
+using TCP/IP, not via Unix sockets. In the latter case, the server must
+use the first handle throughout its lifetime, since the socket is no
+longer accessible after
+.IR chroot .
+.IP db-handle-interval
+The minimum interval (in seconds) between the creation of new database
+handles. The default is
+.IR 120 .
+.SS Logging
+.IP log-address
+The address of the log server. The default is
+.IR 127.0.0.1 .
+.IP log-port
+The port number at which
+.BR logd (8)
+listens, and to which the other servers connect. The default is
+.IR 2054 .
+.IP logfile
+tells
+.BR logd (8)
+where to write log events. It may be set to an absolute file name
+(starting with '/'), or to "syslog/category" (e.g. "syslog/local2"),
+which logs via
+.BR syslog (2),
+or to
+.IR "-" ,
+which causes everything to be logged to
+.IR stdout .
+The default is to log to
+.IR syslog/mail .
+.IP logfile-mode
+is
+.I 400
+by default and controls the permissions used by
+.BR logd (8)
+if it creates
+.IR logfile .
+The format (three octal digits) is the same as that used by
+.BR chmod (1).
+.IP log-level
+may be set to
+.IR debug ,
+.IR info ,
+.IR significant ,
+or
+.IR error ,
+in increasing order of severity (it is
+.I significant
+by default). If a message is logged with this severity or above, the log
+server writes it to the logfile immediately. Messages with lower severity
+are discarded.
+.SS Security
+.IP security
+is
+.I enabled
+by default, and should be enabled whenever Archiveopteryx is
+used in production. It causes the servers to lock themselves into a
+.I chroot
+jail and run with very limited unix and database privileges. Most
+notably, they cannot open files or delete messages.
+.IP
+Turning security off has exactly one advantage: it simplifies
+debugging.
+.IP allow-plaintext-access
+controls whether it is possible to read mail via an unencrypted
+connection. The default value is
+.IR always .
+If this is changed to
+.IR localhost ,
+plaintext connections are permitted only from the host itself.
+If it is changed to
+.IR never ,
+TLS is necessary to read mail.
+.IP jail-directory
+is
+.I /usr/local/archiveopteryx/jail
+by default. On startup, each secure server uses
+.BR chroot (2)
+to jail themselves into this directory, to which the
+.I jail-user
+should have minimal rights (only o+x permissions).
+.IP jail-user
+is the user name under which the servers run, and is
+.I aox
+by default. On startup, the servers change UID to this user. This user
+should not have read or write access to the jail directory.
+.IP jail-group
+is the group name under which the servers run, and is
+.I aox
+by default. On startup, the servers change GID to this user.
+.IP entropy-source
+is the fully-qualified name of a file that acts as a source for random
+bytes, whenever they are needed (e.g. SASL challenges). Set to
+.I /dev/urandom
+by default. If this is instead set to
+.IR /dev/random ,
+Archiveopteryx never uses anything less than perfectly random
+numbers. In this case, make sure that there's enough entropy, or else
+a series of rapid login attempts can block the entire server.
+.SS "User Authentication"
+http://archiveopteryx.org/sasl describes SASL and
+authentication in more detail.
+.IP allow-plaintext-passwords
+controls whether the servers permit plaintext passwords, and how such
+passwords are handled.
+May be set to
+.I always
+(which is the default) or
+.IR never .
+(Future versions of Archiveopteryx will offer more settings.)
+.IP auth-digest-md5
+controls whether the servers offer the digest-md5 SASL mechanism.
+.I Disabled
+by default due to interoperability problems.
+.IP auth-cram-md5
+controls whether the servers offer the cram-md5 SASL mechanism.
+.I Enabled
+by default.
+.IP auth-plain
+controls whether the servers offer the plain-text SASL
+mechanism.
+.I Enabled
+by default.
+.IP
+Note that disabling auth-plain doesn't disable all plaintext
+passwords, since SASL isn't always used. To disable plaintext
+passwords, use the
+.I allow-plaintext-passwords
+variable above.
+.IP auth-anonymous
+controls whether the servers offer anonymous login,
+.I disabled
+by default.
+.SS "Mail delivery"
+.IP use-lmtp
+controls whether
+.BR archiveopteryx (8)
+should accept mail via LMTP (RFC 2033). The default is
+.IR enabled .
+.IP lmtp-address
+specifies the address where
+.BR archiveopteryx (8)
+should listen for LMTP connections, and to which
+.BR deliver (8)
+should connect. The default is
+.IR 127.0.0.1 .
+.IP lmtp-port
+specifies which port
+.BR archiveopteryx (8)
+should listen to, and which port
+.BR deliver (8)
+should connect to. The default is
+.IR 2026 .
+.IP use-smtp
+controls whether
+.BR archiveopteryx (8)
+should accept mail via SMTP/ESMTP (RFC 2821/1869). SMTP is
+.I disabled
+by default.
+.IP smtp-address
+specifies the address where
+.BR archiveopteryx (8)
+should listen for SMTP connections The default is an empty string,
+which means all available IPv4 and IPv6 interfaces.
+.IP smtp-port
+specifies which port
+.BR archiveopteryx (8)
+should listen to. The default is
+.IR 25 .
+.IP use-subaddressing
+controls whether messages addressed to
+.I user+tag@example.org
+are accepted for delivery to
+.I user@example.org
+(if the latter is a valid recipient address). The default is
+.IR false .
+.IP address-separator
+is the character that separates the username from the subaddress in a
+localpart, e.g. the
+.I +
+in
+.IR user+tag@example.org .
+The default, which you should not need to change, is
+.IR + .
+This setting is relevant only if
+.I use-subaddressing
+is true.
+.IP soft-bounce
+specifies whether a delivery problem causes a message to be rejected
+permanently (soft-bounce disabled) or queued at the MTA (soft-bounce
+enabled). This is
+.I enabled
+by default. We recommend disabling it when you are confident that mail
+delivery works.
+.IP message-copy
+specifies whether or not to keep filesystem copies of incoming
+messages, e.g. to burn a mail log to CD/DVD regularly.
+The default value of
+.I none
+means that no copies are ever made.
+.IP
+Setting it to
+.I delivered
+keeps copies of all delivered messages, a value of
+.I errors
+keeps only those messages that could not be delivered because of errors, and
+.I all
+keeps copies of all messages.
+.IP message-copy-directory
+specifies a directory to which mail delivered via LMTP/SMTP is copied, if
+.I message-copy
+is set. Its default value is
+.IR /usr/local/archiveopteryx/jail/messages .
+If you set
+.IR use-security ,
+.I message-copy-directory
+must be a subdirectory of
+.IR jail-directory .
+.IP
+If
+.I message-copy-directory
+does not exist or is not writable,
+Archiveopteryx logs an error at startup and exits.
+.IP
+Each file in
+.I message-copy-directory
+contains one or more header lines, namely
+.BR Error ,
+.B From
+and
+.BR To ,
+then an empty line, then the verbatim received mail message. If there is an
+.B Error
+line, the message was not delivered, and the rest of the line
+describes the problem.
+.IP
+The file's name is a unique string of numbers and hyphens. It ends with
+"-err" if there was an error injecting the message into the database.
+.SS "SMTP Submission"
+.IP use-smtp-submit
+controls whether
+.BR archiveopteryx (8)
+should accept mail via SMTP-Submit (RFC 4409). The default is
+.IR enabled .
+.IP check-sender-addresses
+controls whether
+.BR archiveopteryx (8)
+should check whether the sender is authorised to use the addresses in
+the message. From, Sender, Return-Path (SMTP Mail From) and Reply-To
+are all checked. The default is
+.IR disabled .
+.IP submit-copy-to-sender
+controls whether
+.BR archiveopteryx (8)
+should ensure that the sender receives a copy of outgoing mail. The default
+is
+.IR disabled .
+This can be used to ensure that all outgoing mail is archived.
+.IP
+If the sender already receives a copy of the message,
+.I submit-copy-to-sender
+has no effect. Senders will not receive two copies. The copy is
+always sent to the user who sends the message, even if the From and/or
+Return-Path is different. The sender's copy will be delivered through
+the configured
+.IR smarthost ,
+as with any other outgoing message.
+.IP smtp-submit-address
+specifies the address where
+.BR archiveopteryx (8)
+should listen for Submit connections. The
+default, an empty string, means to listen on all available IPv4 and
+IPv6 addresses.
+.IR 127.0.0.1 .
+.IP smtp-submit-port
+specifies which port
+.BR archiveopteryx (8)
+should listen to. The default is
+.IR 587 .
+.IP smarthost-address
+specifies the address of the SMTP server which is used to relay mail to
+remote recipients. The default is
+.IR 127.0.0.1 .
+.IP smarthost-port
+specifies the port to use when forwarding mail to a smarthost. The
+default is
+.IR 25 .
+(These defaults thus conflict with the default values of
+.I smtp-address
+and
+.I smtp-port
+when
+.I use-smtp
+is enabled.)
+.IP use-smtps
+controls whether
+.BR archiveopteryx (8)
+should accept SSL-wrapped SMTP connections. The default is
+.IR false
+(and the use of STARTTLS with SMTP Submit is strongly recommended
+instead).
+.IP smtps-address
+is the address where
+.BR archiveopteryx (8)
+listens for new SSL-wrapped SMTP connections. As for
+.IR smtp-address ,
+the default is an empty string, which means all available IPv4 and
+IPv6 addresses.
+.IP smtps-port
+is the port where
+.BR archiveopteryx (8)
+accepts SSL-wrapped SMTP connections,
+.I 465
+by default.
+.SS IMAP
+.IP use-imap
+must be enabled for
+.BR archiveopteryx (8)
+to accept IMAP connections. The default is
+.IR true .
+.IP imap-address
+is the address where
+.BR archiveopteryx (8)
+listens for new connections. The
+default, an empty string, means to listen on all available IPv4 and
+IPv6 addresses.
+.IP imap-port
+is the port where
+.BR archiveopteryx (8)
+accepts connections,
+.I 143
+by default.
+.IP use-imaps
+controls whether
+.BR archiveopteryx (8)
+should also accept SSL-wrapped IMAP connections. The default is
+.I false
+(and the use of STARTTLS over the standard IMAP port is strongly
+recommended instead).
+.IP imaps-address
+is the address where
+.BR archiveopteryx (8)
+listens for new SSL-wrapped connections. As with
+.IR imap-address ,
+the default is an empty string, which means all available IPv4 and
+IPv6 addresses.
+.IP imaps-port
+is the port where
+.BR archiveopteryx (8)
+accepts SSL-wrapped connections,
+.I 993
+by default.
+.IP use-imap-quota
+must be enabled for
+.BR archiveopteryx (8)
+to support the IMAP QUOTA extension. This quota is not enforced and is
+recommended to be disabled on large mailboxes. The default is
+.IR true .
+.SS POP
+.IP use-pop
+must be enabled for
+.BR archiveopteryx (8)
+to accept POP3 connections. The default is
+.IR false .
+.IP pop-address
+is the address where
+.BR archiveopteryx (8)
+listens for new connections. The default, an empty string, means to
+listen on all available IPv4 and IPv6 addresses.
+.IP pop-port
+is the port where
+.BR archiveopteryx (8)
+accepts connections,
+.I 110
+by default.
+.IP use-pops
+controls whether
+.BR archiveopteryx (8)
+should also accept SSL-wrapped POP connections. The default is
+.I false
+(and the use of STARTTLS over the standard POP port is strongly
+recommended instead).
+.IP pops-address
+is the address where
+.BR archiveopteryx (8)
+listens for new SSL-wrapped connections. As with
+.IR pop-address ,
+the default is an empty string, which means all available IPv4 and
+IPv6 addresses.
+.IP pops-port
+is the port where
+.BR archiveopteryx (8)
+accepts SSL-wrapped connections,
+.I 995
+by default.
+.SS SIEVE
+.IP use-sieve
+controls whether or not the
+.I managesieve
+server is started. The default is
+.IR enabled .
+.IP managesieve-address
+specifies the address where
+.BR archiveopteryx (8)
+should listen for connections. The default is an empty string, which
+means to listen on all available IPv4 and IPv6 addresses.
+.IP managesieve-port
+specifies which port
+.BR archiveopteryx (8)
+should listen to. The default is
+.IR 2000 .
+.SS TLS
+.IP use-tls
+regulates whether Archiveopteryx supports TLS at all. The default is
+.IR enabled .
+.IP tls-certificate
+is the absolute file name of the TLS private key and signed certificate,
+e.g.
+.IR /usr/local/archiveopteryx/imap.p15 .
+If
+.I tls-certificate
+is not specified, tlsproxy generates a private key and a self-signed
+certificate at runtime and stores both in
+.IR /usr/local/archiveopteryx/automatic-key.pem .
+.IP tls-certificate-label
+is not used in 3.1.4.
+.SH SYNTAX
+.PP
+The name is case insensitive, as shown:
+.IP
+hostname = test1.example.com
+.br
+HOSTNAME = mailserver.example.org
+.PP
+The value is case insensitive wherever possible. (Exceptions
+include logfile, db-user and db-password.)
+.PP
+There are three datatypes: Strings, numbers and toggles.
+.PP
+Strings may be written as a single unquoted word or quoted with either
+single or double quotes, as shown in these three examples:
+.IP
+db-password = single.word
+.br
+db-password = "rock'n'roll" # a 12-character password
+.br
+db-password = 'two words, quoted' # a 17-character one
+.PP
+Only single-line strings can be used. Single-word strings may contain
+the characters a-z, A-Z, 0-9, dot, hyphen and slash.
+.PP
+Numbers are integers not smaller than 0 and not larger than 2147483647
+(ie. 31-bit unsigned integers).
+.PP
+Toggles are written as a single word.
+.IR Yes ,
+.IR true ,
+.IR on ,
+.IR 1 ,
+and
+.I enabled
+all
+mean that the toggle is enabled, while
+.IR no ,
+.IR false ,
+.IR off ,
+.IR 0 ,
+and
+.I disabled
+unsurprisingly mean disabled. Toggles are case-insensitive.
+.IP
+use-lmtp = yes
+.br
+crash-and-delete-all-the-mail = off
+.PP
+Spaces are allowed at the start of the line, before and after '=', and
+after the value. Comments extend from '#' to the end of the line.
+.IP
+# this is a comment
+.br
+hostname=stuff.nonsense.example.com # also a comment
+.br
+ logfile    =   /dev/null# and this is a comment
+.br
+# empty lines are ignored
+.SH AUTHOR
+The Archiveopteryx Developers, info@aox.org.
+.SH VERSION
+This man page covers Archiveopteryx version 3.2.0, released 2014-03-10,
+http://archiveopteryx.org/3.2.0
+.SH SEE ALSO
+.BR archiveopteryx (8),
+.BR deliver (8),
+.BR logd (8),
+http://archiveopteryx.org
diff --git b/instrumentation/aox/doc/man/man8/aox.8 a/instrumentation/aox/doc/man/man8/aox.8
new file mode 100644
index 0000000..e6146a9
--- /dev/null
+++ a/instrumentation/aox/doc/man/man8/aox.8
@@ -0,0 +1,245 @@
+.\\" Copyright 2009 The Archiveopteryx Developers <info@aox.org>
+.TH aox 8 2014-03-10 aox.org "Archiveopteryx Documentation"
+.SH NAME
+aox - management tool for Archiveopteryx.
+.SH SYNOPSIS
+.B /usr/local/archiveopteryx/bin/aox
+.I verb
+.I noun
+[
+.I options
+] [
+.I arguments
+]
+.PP
+.B aox help commands
+.PP
+.B aox help
+.I command
+.SH DESCRIPTION
+.nh
+.PP
+.B aox
+is a command-line program to perform various system administration
+tasks for Archiveopteryx.
+.PP
+Examples of such tasks are adding users, changing the access control
+for mailboxes, etc. In principle, everything one would want to do
+using a shell script should be doable using
+.BR aox .
+.SH COMMANDS
+.IP "aox start [-v]"
+Starts the Archiveopteryx servers in the correct order.
+.IP "aox stop [-v]"
+Stops the running Archiveopteryx servers in the correct order.
+.IP "aox restart [-v]"
+Restarts the servers in the correct order (currently equivalent to start
+&& stop).
+.IP "aox show status [-v]"
+Displays a summary of the running Archiveopteryx servers.
+.IP "aox show configuration [-p -v] [variable-name]"
+Displays variables configured in
+.IR archiveopteryx.conf .
+.IP
+If a
+.I variable-name
+is specified, only that variable is displayed.
+.IP
+The -v flag displays only the value of the variable.
+.IP
+The -p flag restricts the results to variables whose value has been
+changed from the default.
+.IP
+.I configuration
+may be abbreviated as
+.IR cf .
+.IP "aox show build"
+Displays the build settings used for this installation (as configured
+in Jamsettings).
+.IP "aox show counts [-f]"
+Displays the number of rows in the most important tables, as well as the
+total size of the mail stored.
+.IP
+The -f flag causes it to collect slow-but-accurate statistics. Without
+it, by default, you get quick estimates (more accurate after VACUUM
+ANALYSE).
+.IP "aox show queue"
+Displays a list of all mail queued for delivery to a smarthost.
+.IP "aox show schema"
+Displays the revision of the existing database schema.
+.IP "aox upgrade schema [-n]"
+Checks that the database schema is one that this version of
+Archiveopteryx is compatible with, and updates it if needed.
+.IP
+The -n flag causes aox to perform the SQL statements for the schema
+upgrade and report on their status without COMMITing the transaction
+(i.e. see what the upgrade would do, without doing anything).
+.IP "aox update database"
+Performs any updates to the database contents which are too slow for
+inclusion in
+.IR "aox upgrade schema" .
+This command is meant to be used while the server is running. It does
+its work in small chunks, so it can be restarted at any time, and is
+tolerant of interruptions.
+.IP "aox tune database <mostly-writing|mostly-reading|advanced-reading>"
+Adjusts the database indices and configuration to suit expected usage
+patterns.
+.IP "aox list mailboxes [-d] [-o username] [pattern]"
+Displays a list of mailboxes matching the specified shell glob pattern.
+Without a pattern, all mailboxes are listed.
+.IP
+The -d flag includes deleted mailboxes in the list.
+.IP
+The "-o username" flag restricts the list to mailboxes owned by the
+specified user.
+.IP
+The -s flag shows a count of messages and the total size of the messages
+in each mailbox.
+.IP
+.I ls
+is an acceptable abbreviation for
+.IR list .
+.IP "aox list users [pattern]"
+Displays a list of users matching the specified shell glob pattern.
+Without a pattern, all users are listed.
+.IP "aox list aliases [pattern]"
+Displays a list of aliases where either the address or the target
+mailbox matches the specified shell glob pattern. Without a pattern,
+all aliases are listed.
+.IP "aox list rights <mailbox> [username]"
+Displays a list of users and the rights they have been granted to the
+specified mailbox. If a username is given, only that user's rights are
+displayed.
+.IP "aox add user <username> <password> <email-address>"
+.IP "aox add user -p <username> <email-address>"
+Creates a new Archiveopteryx user with the specified username, password, and
+email address. If the
+.I -p
+flag is specified, the password is read interactively, instead of from
+the command-line.
+.IP
+.I create
+and
+.I new
+are acceptable abbreviations for
+.IR add .
+.IP "aox delete user [-f] <username>"
+Deletes the specified Archiveopteryx user. If
+.I -f
+is specified, any mailboxes owned by the user are also deleted.
+.IP
+.I del
+and
+.I remove
+are acceptable abbreviations for
+.IR delete .
+.IP "aox change password <username> <new-password>"
+.IP "aox change password -p <username>"
+Changes the specified user's password. If the
+.I -p
+flag is specified, the password is read interactively, instead of from
+the command-line.
+.IP "aox change username <username> <new-username>"
+Renames the specified user.
+.IP "aox change address <username> <new-address>"
+Changes the specified user's email address.
+.IP "aox add mailbox <name> [username]"
+Creates a new mailbox with the specified name and, if a username is
+specified, owned by that user.
+.IP
+The mailbox
+.I name
+must be fully-qualified (begin with /), unless a
+.I username
+is specified, in which case unqualified names are assumed to be under
+the user's home directory.
+.IP "aox delete mailbox [-f] <name>"
+Deletes the specified mailbox.
+.IP
+If
+.I -f
+is specified, the mailbox and any messages it contains are permanently
+deleted. Otherwise, only empty mailboxes are deleted.
+.IP "aox add alias <address> <mailbox>"
+Creates an alias that instructs the server to accept mail to the given
+.I address
+and deliver it to the specified
+.IR mailbox .
+.IP "aox delete alias <address>"
+Deletes an alias, if one exists, for the given
+.IR address .
+.IP "aox setacl [-d] <mailbox> <identifier> <rights>"
+Assigns the specified rights to the given identifier on the mailbox. If
+the rights begin with + or -, the specified rights are added to or
+subtracted from the existing rights; otherwise, the rights are set to
+exactly those given.
+.IP
+With -d, the identifier's rights are deleted altogether.
+.IP
+A summary of the changes made is displayed when the operation completes.
+.IP "aox undelete <mailbox> <search>"
+Searches for deleted messages in the specified mailbox and
+restores those that match the search.
+.PP
+Messages can be restored after an IMAP EXPUNGE or POP3 DELE
+until aox vacuum permanently removes them after the configured
+.IR undelete-time .
+.PP
+Example: aox undelete /users/fred/inbox from example.com
+.IP "aox vacuum"
+Permanently deletes messages that were marked for deletion more than
+.I undelete-time
+days ago, and removes any bodyparts that are no longer used.
+.IP
+This is not a replacement for running VACUUM ANALYSE on the database
+(either with vacuumdb or via autovacuum).
+.IP
+This command should be run (we suggest daily) via crontab.
+.IP "aox anonymise <file>"
+Reads a mail message from the named file, obscures most or all content
+and prints the result on stdout. The output resembles the original
+closely enough to be used in a bug report.
+.IP "aox reparse"
+Looks for messages that "arrived but could not be stored" and tries to
+parse them using workarounds that have been added more recently. If it
+succeeds, the new message is injected and the old one deleted.
+.IP "aox grant privileges <username>"
+makes sure that the named user has all the permissions needed for the
+db-user (i.e., and unprivileged user), and no more.
+.IP "aox check config"
+reads the configuration files and reports any problems that it finds.
+.SH OPTIONS
+The -v flag enables (slightly) more verbose diagnostic output wherever
+it is supported (see the descriptions of each command above).
+.SH EXAMPLES
+To add a user called "nirmala", whose password is "angstskrik" and
+whose main email address is "nirmala@example.com":
+.IP
+aox add user nirmala angstskrik nirmala@example.com
+.PP
+To change Nirmala's password to "temmelig hemmelig":
+.IP
+aox change password nirmala 'temmelig hemmelig'
+.PP
+To remove that user:
+.IP
+aox remove user nirmala
+.SH DIAGNOSTICS
+The return code of
+.B aox
+is zero if all goes well, and a non-zero in case of errors.
+.PP
+Diagnostics are logged using Archiveopteryx's
+.BR logd (8),
+just like the servers do. Disasters are also logged via stderr.
+.SH BUGS
+There is no command-line option to set the configuration file.
+.SH AUTHOR
+The Archiveopteryx Developers, info@aox.org.
+.SH VERSION
+This man page covers Archiveopteryx version 3.2.0, released 2014-03-10,
+http://archiveopteryx.org/3.2.0
+.SH SEE ALSO
+.BR archiveopteryx (8),
+.BR archiveopteryx.conf (5),
+http://archiveopteryx.org
diff --git b/instrumentation/aox/doc/man/man8/aoxdeliver.8 a/instrumentation/aox/doc/man/man8/aoxdeliver.8
new file mode 100644
index 0000000..e74e551
--- /dev/null
+++ a/instrumentation/aox/doc/man/man8/aoxdeliver.8
@@ -0,0 +1,85 @@
+.\\" Copyright 2009 The Archiveopteryx Developers <info@aox.org>
+.TH aoxdeliver 8 2014-03-10 aox.org "Archiveopteryx Documentation"
+.SH NAME
+aoxdeliver - deliver mail into Archiveopteryx.
+.SH SYNOPSIS
+.B /usr/local/archiveopteryx/bin/aoxdeliver [-f sender] [-t mailbox] [-v] destination [filename]
+.SH DESCRIPTION
+.nh
+.PP
+The
+.B aoxdeliver
+program injects a single mail message in RFC-822 format into
+Archiveopteryx.
+It connects to Archiveopteryx's backend database and injects the message
+into the correct mailbox.
+.PP
+.B aoxdeliver
+is meant as a compatibility shim for use with e.g.
+.BR formail (1)
+and with MTAs that want to deliver to a program.
+Note that you will generally get better performance by using LMTP.
+.PP
+.B aoxdeliver
+bypasses Sieve and always stores mail directly into the target mailbox.
+.SH OPTIONS
+.IP "-f sender"
+specifies the fully qualified address of the message sender. This is
+the same as the SMTP envelope sender.
+.IP
+Starting with version 2.01, the
+.I -f
+argument is ignored. It is still accepted to keep old scripts working.
+.IP "-t mailbox"
+directs
+.B aoxdeliver
+to store the message into the named mailbox. The "p" right on the
+mailbox must be granted to "anyone". ("p" controls who is permitted to
+send mail to the mailbox, see RFC 4314 for more details.)
+.IP "-v"
+requests more verbosity during delivery. May be specified twice.
+.SH EXAMPLES
+To deliver an entire berkeley mbox into the inbox of user nirmala@example.com:
+.IP
+formail -s aoxdeliver nirmala@example.com < mbox
+.PP
+To deliver each message in the MH folder +blah into the
+inbox of user raj@example.net:
+.IP
+folder +blah
+.br
+seq all | xargs -n1 aoxdeliver raj@example.net
+.PP
+To deliver each message in the MH folder +ramble into folder stumble
+of user raj@example.net:
+.IP
+folder +blah
+.br
+seq all | xargs -n1 aoxdeliver -t stumble raj@example.net
+.PP
+If raj has not granted "anyone" the "p" right ("p"ost mail to
+mailbox), this example fails.
+.SH DIAGNOSTICS
+The normal exit status of
+.B aoxdeliver
+is 0. In case of errors,
+.B aoxdeliver
+returns an error code from sysexits.h, such as EX_TEMPFAIL, EX_NOUSER, etc.
+.SH BUGS
+Delivering multiple messages would also be good, for those big mailbox
+migrations. In that case,
+.B
+aoxdeliver
+should report which messages could be delivered and which could not.
+.PP
+There is no command-line option to set the configuration file.
+.SH AUTHOR
+The Archiveopteryx Developers, info@aox.org.
+.SH VERSION
+This man page covers Archiveopteryx version 3.2.0, released 2014-03-10,
+http://archiveopteryx.org/3.2.0
+.SH SEE ALSO
+.BR archiveopteryx (8),
+.BR archiveopteryx.conf (5),
+.BR logd (8),
+http://archiveopteryx.org
diff --git b/instrumentation/aox/doc/man/man8/aoximport.8 a/instrumentation/aox/doc/man/man8/aoximport.8
new file mode 100644
index 0000000..12aeb46
--- /dev/null
+++ a/instrumentation/aox/doc/man/man8/aoximport.8
@@ -0,0 +1,69 @@
+.\\" Copyright 2009 The Archiveopteryx Developers <info@aox.org>
+.TH aoximport 8 2014-03-10 aox.org "Archiveopteryx Documentation"
+.SH NAME
+aoximport - import messages into Archiveopteryx.
+.SH SYNOPSIS
+.B /usr/local/archiveopteryx/bin/aoximport
+[-vqe]
+.I mailbox
+.I type
+.I source-file
+[
+.I source-file ...
+]
+.SH DESCRIPTION
+.nh
+.PP
+.B aoximport
+is used to import messages into Archiveopteryx en masse from other
+mailboxes (mbox, MH, maildir and Cyrus mailboxes are currently supported).
+.SH OPTIONS
+.IP -v
+enables more verbose output. Can be repeated.
+.IP -q
+sets the verbosity to zero.
+.IP -e
+makes
+.B aoximport
+write problem messages to the errors subdirectory. If a message has parse problems,
+.B aoximport
+writes a copy of the message to errors/anonymised if anonymisation
+preserves the error, and to errors/plaintext else. The message is also
+written to the target mailbox, as an attachment to a special error
+message.
+.IP
+The messages in the errors directory may be sent to info@aox.org, and
+we'll try to find out what the problem is. Please delete
+personal/confidential messages from errors/plaintext first.
+.SH SYNTAX
+In the synopsis above,
+.I mailbox
+is the fully-qualified name of the destination mailbox (which must
+exist) into which messages are imported.
+.I type
+may be
+.IR mbox ,
+.IR maildir ,
+.IR mh ,
+or
+.IR cyrus .
+The remaining arguments are interpreted as mailbox filenames of the
+specified
+.IR type .
+.SH EXAMPLES
+To import messages from the mbox files in ~/Mail/imap/* to a mailbox
+named /users/nirmala/imap:
+.IP
+aoximport /users/nirmala/imap mbox ~/Mail/imap/*
+.PP
+After a large import, it's a good idea to run
+.IR "aox vacuum" .
+.SH AUTHOR
+The Archiveopteryx Developers, info@aox.org.
+.SH VERSION
+This man page covers Archiveopteryx version 3.2.0, released 2014-03-10,
+http://archiveopteryx.org/3.2.0
+.SH SEE ALSO
+.BR aox (8),
+.BR archiveopteryx (8),
+http://archiveopteryx.org
diff --git b/instrumentation/aox/doc/man/man8/archiveopteryx.8 a/instrumentation/aox/doc/man/man8/archiveopteryx.8
new file mode 100644
index 0000000..9daee3b
--- /dev/null
+++ a/instrumentation/aox/doc/man/man8/archiveopteryx.8
@@ -0,0 +1,213 @@
+.\\" Copyright 2009 The Archiveopteryx Developers <info@aox.org>
+.TH archiveopteryx 7 2014-03-10 aox.org "Archiveopteryx Documentation"
+.SH NAME
+Overview of Archiveopteryx.
+.SH SYNOPSIS
+.B /etc/init.d/archiveopteryx {start,stop}
+.PP
+.B /usr/local/archiveopteryx/*.conf
+.SH DESCRIPTION
+.nh
+.PP
+Archiveopteryx is a mail server system optimised for long-term storage
+and heavy access. It comprises a set of server programs that provide
+access to mail stored in a relational database (PostgreSQL).
+.SH "GETTING STARTED"
+The following five steps should suffice to install Archiveopteryx. If they
+don't, or if anything is unclear, more detailed instructions are
+available at http://archiveopteryx.org/installation
+.SS "1. Install Archiveopteryx"
+Usually, this is as simple as:
+.IP
+.B "apt-get install archiveopteryx"
+(on Debian)
+.br
+.B "pkg install archiveopteryx"
+(on FreeBSD)
+.PP
+http://archiveopteryx.org/installation explains what to do in
+other cases.
+.PP
+Use
+.IP
+.B /usr/local/archiveopteryx/lib/archiveopteryx start
+.PP
+to start Archiveopteryx using the default configuration from
+.BR archiveopteryx.conf ,
+which tries hard to be sensible.
+.SS "2. Add a user"
+Run
+.IP
+aox add user
+.I name
+.I password
+.I address@domain
+.PP
+to create a username and password.
+.SS "3. Inject some test mail"
+You can use
+.BR deliver (8)
+to inject some mail you already have.
+.PP
+This command injects all the messages from a berkeley mbox file:
+.IP
+formail -s deliver yourname@domain < mbox
+.PP
+.SS "4. Check that you can read mail"
+The mail you just delivered is in your inbox, and you can read it with
+any IMAP or POP3 client.
+.SS "5. Configure your MTA"
+The normal way to deliver mail from your MTA into Archiveopteryx is via LMTP.
+By default, Archiveopteryx listens on 127.0.0.1 port 2026.
+.PP
+On aox.org we describe how to configure some common MTAs to work with
+Archiveopteryx. See e.g. http://archiveopteryx.org/postfix for
+.BR postfix (1).
+.SH ARCHITECTURE
+.PP
+Archiveopteryx consists of a number of frontend servers, each of which uses
+backend servers:
+.IP RDBMS
+The RDBMS is where all the mail is stored. At present only PostgreSQL
+is supported.
+.IP logd
+The log server is an internal server which filters log entries so
+useful messages are logged while noise is suppressed.
+.PP
+Each server is described more fully in its own man page:
+.BR logd (8),
+.BR postgres (1)
+and
+.BR archiveopteryx (8)
+for the frontend server, which serves IMAP, POP3, LMTP and/or SMTP and
+perhaps webmail.
+.PP
+Normally, there is one
+.BR logd (8)
+process running. In addition there will be at least one
+.BR postgres (1)
+and one
+.BR archiveopteryx (8)
+process.
+.PP
+The servers use TCP to communicate internally, so they can be
+distributed across a server cluster. Generally, one host will run the
+database backend, one host (perhaps the same) will run
+.BR logd (8)
+and as many as required will run frontends.
+.PP
+The man pages for each server explain the use and configuration of
+each. See
+.BR archiveopteryx.conf (5)
+for more about configuring Archiveopteryx in general.
+.SH SECURITY
+All Archiveopteryx servers run in chroot directories.
+.PP
+The user-facing servers run in a special jail directory. They have
+neither read nor write access to this directory.
+.PP
+.BR logd (8)
+runs chrooted to another directories. All of the servers close all open
+files at startup and drop root privileges. By default they run as user
+.IR aox ,
+group
+.IR aox ,
+although these names can be changed using
+.BR archiveopteryx.conf (5).
+.PP
+The servers check that they lose prvileges as expected, and refuse to
+start if they're too privileged.
+.PP
+Note that
+.BR logd (8)
+must have permission to create the
+.IR logfile .
+.SH MAIL STORAGE
+Archiveopteryx does not store mail in the RFC-822 format. It parses each
+message upon delivery, and stores a normalized representation, optimized
+for fast and reliable search and categorization.
+.PP
+This offers the following advantages, among others:
+.IP Performance
+One example: Each address is stored exactly once, as Unicode and with
+RFC-2047 encoding undone. Finding all messages sent from/to a given
+name is extremely fast, because only a single SQL SELECT is necessary,
+and it accesses just two small tables.
+.IP "Long-term Stability"
+Archiveopteryx handles today's common syntax problems and stores the
+correct form in the database. Because of that, the mail reader which
+looks at old mail in the year 2020 will not need to be bug compatible
+with today's version of Microsoft Outlook.
+.IP "Scalability and Flexibility"
+Only the database size limits Archiveopteryx's capacity. Many other servers
+limit individual folders to 2GB (or less), or cannot support more than
+a few thousand subfolders/messages in a folder. With Archiveopteryx, you
+don't need to invent workarounds for such artificial limitations.
+.IP Robustness
+Because mail is stored normalized and parsed, large attachments are
+generally stored only once, and mail parsing exploits are rendered
+harmless before reaching the MUA. A movie clip sent to a hundred
+recipients is not a problem, because it's stored just once.
+.SH LICENSING
+Archiveopteryx is available under the PostgreSQL License.
+.SH DEFAULTS
+The configurable file and directory names in this build are as follows:
+.IP SBINDIR
+(where servers live) is
+.IR /usr/local/archiveopteryx/sbin .
+.IP BINDIR
+(where other executables live) is
+.IR /usr/local/archiveopteryx/bin .
+.IP INITDIR
+(where the startup script lives) is
+.IR /usr/local/archiveopteryx/lib .
+.IP MANDIR
+(where manpages live) is
+.IR /usr/local/archiveopteryx/man .
+.IP PIDFILEDIR
+(where pidfiles live) is
+.IR /usr/local/archiveopteryx/lib/pidfiles .
+.IP LIBDIR
+(where supporting files live) is
+.IR /usr/local/archiveopteryx/lib .
+.IP JAILDIR
+(the working directory of the user-facing servers) is
+.IR /usr/local/archiveopteryx/jail ,
+and can be overridden using the
+.I jail-directory
+variable in
+.BR archiveopteryx.conf (5).
+.IP CONFIGDIR
+(where the configuration files live) is
+.IR /usr/local/archiveopteryx .
+.IP LOGFILE
+(the full name of the logfile) is
+.IR syslog/mail ,
+and can be overridden using the
+.I logfile
+variable in
+.BR archiveopteryx.conf (5).
+.PP
+These variables can be changed only by editing the file Jamsettings
+and recompiling Archiveopteryx. Jamsettings also contains some variables
+used only during compilation and/or installation, and some which
+provide defaults for
+.BR archiveopteryx.conf (5)
+settings.
+.SH FILES
+.IP /usr/local/archiveopteryx/archiveopteryx.conf
+contains the Archiveopteryx configuration.
+.IP /usr/local/archiveopteryx/lib/automatic-key.pem
+contains a private key and self-signed certificate used by
+.BR openssl (3).
+.SH AUTHOR
+The Archiveopteryx Developers, info@aox.org.
+.SH VERSION
+This man page covers Archiveopteryx version 3.2.0, released 2014-03-10,
+http://archiveopteryx.org/3.2.0
+.SH SEE ALSO
+.BR archiveopteryx (8),
+.BR archiveopteryx.conf (5),
+.BR deliver (8),
+.BR logd (8),
+http://archiveopteryx.org
diff --git b/instrumentation/aox/doc/man/man8/installer.8 a/instrumentation/aox/doc/man/man8/installer.8
new file mode 100644
index 0000000..b96ecb3
--- /dev/null
+++ a/instrumentation/aox/doc/man/man8/installer.8
@@ -0,0 +1,130 @@
+.\\" Copyright 2009 The Archiveopteryx Developers <info@aox.org>
+.TH installer 8 2014-03-10 aox.org "Archiveopteryx Documentation"
+.SH NAME
+installer - Archiveopteryx installer.
+.SH SYNOPSIS
+.B /usr/local/archiveopteryx/lib/installer
+[
+.I -n
+] [
+.I -q
+] [
+.I -v
+] ...
+.SH DESCRIPTION
+.nh
+.PP
+This program does the following:
+.PP
+1. Creates a Unix group named aox.
+.PP
+2. Creates a Unix user named aox.
+.PP
+3. Creates a Postgres user named aox.
+.PP
+4. Creates a Postgres user named aoxsuper.
+.PP
+5. Creates a Postgres database named archiveopteryx owned by aoxsuper.
+.PP
+6. Loads the database schema and grants limited privileges to user aox.
+.PP
+7. Generates an initial configuration file.
+.PP
+8. Adjusts ownership and permissions if necessary.
+.PP
+.B installer
+should be run after
+.I "jam install"
+when installing from source.
+.PP
+By default, the address of the PostgreSQL server is derived from the
+compile-time
+.I DBADDRESS
+setting in the
+.I Jamsettings
+file (which is
+.I 127.0.0.1
+by default). If the
+.I db-address
+variable is set in an existing configuration file, that value takes
+precedence. If the
+.I -a
+command-line flag is used, then the address specified has precedence
+over either of the former values.
+.PP
+If the server address (as determined above) is
+.IR 127.0.0.1 ,
+the installer will try to use a Unix domain socket to connect to the
+server. The location of this socket is determined by the
+.I -s socket
+command-line argument. If no socket is specified, the default named
+socket location (
+.IR /tmp/.s.PGSQL.5432 )
+is used instead.
+For any other server address, the installer will try to use a Unix
+domain socket only if one is explicitly specified with
+.IR -s .
+In any case, if password authentication is to be used when talking to
+the server, the
+.I -P
+option will cause the installer to prompt for the password.
+.SH OPTIONS
+.IP -q
+Suppresses all normal output.
+.IP -v
+Makes the output more verbose (may be repeated).
+.IP -n
+Causes the program to report what it would do, but not actually do
+anything.
+.IP "-g group"
+Allows you to specify a Unix group other than the default of aox.
+.IP "-u user"
+Allows you to specify a Unix username other than the default of
+aox.
+.IP "-p postgres"
+Allows you to specify the name of the PostgreSQL superuser. The default
+is to try $PGUSER (if set), postgres and pgsql in turn.
+.IP "-P"
+Instructs the installer to prompt for and read the PostgreSQL
+superuser's password, and be prepared to use that for authentication (if
+necessary).
+.IP "-a address"
+Allows you to specify a different address for the Postgres server. The
+default is 127.0.0.1.
+.IP "-s /path/to/socket"
+Allows you to specify a location for the PostgreSQL server's Unix-domain
+listening socket. The specified value is used as described above.
+.IP "-t port"
+Allows you to specify a different port for the Postgres server. The
+default is 5432. (This value is used only if the server address does
+not refer to a Unix socket.)
+.IP "-d dbname"
+Allows you to specify a database to use. The default is
+.IR archiveopteryx .
+.IP "-S schema"
+Allows you to specify a schema where the Archiveopteryx database objects
+will be installed. If this is not specified, objects are installed into
+the
+.I public
+schema.
+.IP
+Please do not use
+.I -S
+unless you are sure you understand all its implications. It is safe to
+ignore it entirely if you don't.
+.PP
+The defaults come from
+.IR Jamsettings .
+.SH DIAGNOSTICS
+The return code is zero if all goes well, and a non-zero in case of
+errors. Disasters are logged via stderr.
+.SH AUTHOR
+The Archiveopteryx Developers, info@aox.org.
+.SH VERSION
+This man page covers Archiveopteryx version 3.2.0, released 2014-03-10,
+http://archiveopteryx.org/3.2.0
+.SH SEE ALSO
+.BR archiveopteryx (8),
+.BR archiveopteryx.conf (5),
+.BR logd (8),
+http://archiveopteryx.org
diff --git b/instrumentation/aox/doc/man/man8/logd.8 a/instrumentation/aox/doc/man/man8/logd.8
new file mode 100644
index 0000000..52cf266
--- /dev/null
+++ a/instrumentation/aox/doc/man/man8/logd.8
@@ -0,0 +1,96 @@
+.\\" Copyright 2009 The Archiveopteryx Developers <info@aox.org>
+.TH logd 8 2014-03-10 aox.org "Archiveopteryx Documentation"
+.SH NAME
+logd - logging server for Archiveopteryx.
+.SH SYNOPSIS
+.B /usr/local/archiveopteryx/sbin/logd [-f] [-c configfile]
+.SH DESCRIPTION
+.nh
+.PP
+The Archiveopteryx
+.B logd
+is an internal server which receives, buffers and filters log entries
+from other parts of Archiveopteryx, so that useful messages are logged, while
+noise is suppressed.
+.PP
+Archiveopteryx's log system uses four log levels:
+.IR Disaster ,
+.IR Error ,
+.I Info
+and
+.IR Debug .
+Each program in Archiveopteryx sends its log messages to
+.BR logd ,
+which writes them to a logfile.
+.PP
+If a message is logged with severity
+.IR log-level
+(set to
+.I Info
+by default) or greater, it is immediately written to the log file. All
+messages of lower severity are discarded.
+.PP
+If
+.B logd
+receives the SIGHUP signal, it closes and reopens its logfile.
+.PP
+After startup,
+.B logd
+changes root to the directory where
+.I logfile
+is located, and changes uid and gid to
+.I jail-user
+and
+.IR  jail-group .
+Therefore,
+.I jail-user
+must have the right to open
+.IR logfile .
+.SH OPTIONS
+.IP "-c filename"
+Read configuration variables from
+.I filename
+instead of from
+.IR /usr/local/archiveopteryx/archiveopteryx.conf .
+.IP -f
+Fork into background during startup.
+.SH CONFIGURATION
+.B logd
+is configured using
+.BR archiveopteryx.conf (5).
+.PP
+.B logd
+uses the following configuration variables:
+.IR log-address ,
+.IR log-port ,
+.I logfile
+(default syslog/mail),
+.I log-level
+(default
+.IR info ),
+.I jail-user
+(default
+.IR aox ),
+.I jail-group
+(default
+.IR aox ).
+.SH DIAGNOSTICS
+In case of error,
+.B smtpd
+exits with exit code 1, an error message on stderr and (usually more
+detailed) information in the log file.
+.SH FILES
+/usr/local/archiveopteryx/archiveopteryx.conf
+.br
+/usr/local/archiveopteryx/sbin/logd
+.SH AUTHOR
+The Archiveopteryx Developers, info@aox.org.
+.SH VERSION
+This man page covers Archiveopteryx version 3.2.0, released 2014-03-10,
+http://archiveopteryx.org/3.2.0
+.SH SEE ALSO
+.BR archiveopteryx (8),
+.BR archiveopteryx.conf (5),
+.BR deliver (8),
+.BR aox (8),
+http://archiveopteryx.org
diff --git b/instrumentation/aox/doc/man/man8/recorder.8 a/instrumentation/aox/doc/man/man8/recorder.8
new file mode 100644
index 0000000..eae432b
--- /dev/null
+++ a/instrumentation/aox/doc/man/man8/recorder.8
@@ -0,0 +1,99 @@
+.\\" Copyright 2009 The Archiveopteryx Developers <info@aox.org>
+.TH recorder 8 2014-03-10 aox.org "Archiveopteryx Documentation"
+.SH NAME
+recorder - IMAP connection recorder
+.SH SYNOPSIS
+.B /usr/local/archiveopteryx/sbin/recorder srcport address destport file
+.SH DESCRIPTION
+.nh
+.PP
+The
+.B recorder
+program relays data between an IMAP client and server, and records the
+session in a format which allows the Archiveopteryx developers to replay
+and analyse it later.
+.PP
+If you have problems getting
+.BR archiveopteryx (8)
+to work with a particular IMAP client, you can make the client connect
+to the
+.BR recorder ,
+instead of directly to
+.BR imapd ,
+and
+.B recorder
+will produce a transcript of the IMAP session. If the client opens more
+than one connection,
+.B recorder
+stores more than one file.
+.PP
+The file format is pure ASCII and can be edited. We suggest that you
+edit out your password, then send the rest to info@aox.org and we may
+be able to find out what's happening.
+.PP
+We have debug tools that can replay the connection, so we can fix any
+bugs on the server's side. In some cases, we can also add the file to
+our regression tests, so we can be sure that new versions of
+.BR archiveopteryx (8)
+do not have the same error.
+.SH EXAMPLE
+To intercept and record traffic to the IMAP server
+on 192.0.2.17 and place a record of the connections in files called
+.I /tmp/bugreport*
+you can do the following:
+.SS "Disable TLS"
+.PP
+.B recorder
+does not work when TLS is being used. (To TLS, a tool like
+.B recorder
+looks like a man-in-the-middle attack.)
+.PP
+To disable TLS, set the variable
+.I use-tls
+to
+.I disabled
+in
+.I /usr/local/archiveopteryx/archiveopteryx.conf
+(see the
+.BR archiveopteryx.conf (5)
+man page for more information.)
+.SS "Restart Archiveopteryx"
+The change to
+.I use-tls
+only takes effect when you restart Archiveopteryx, e.g. by issuing the
+following command:
+.IP
+/usr/local/archiveopteryx/lib/archiveopteryx restart
+.SS "Start recorder"
+To make recorder listen on port 1430 and forward connections
+to the real server on port 143:
+.IP
+/usr/local/archiveopteryx/sbin/recorder 1430 192.0.2.17 143 /tmp/bugreport
+.SS "Connect to recorder"
+With the IMAP client, you connect to port 1430 on this host instead of
+the real server, and work as usual. Please don't do much more than is
+necessary to reproduce the problem, because it makes the bugreport
+files grow very large.
+.IP Stop
+Just hit Control-C to stop
+.B recorder
+when you're done. The files called
+.I /tmp/bugreport*
+contain the IMAP session transcripts.
+.IP "Remove passwords"
+Please edit the files to remove any passwords or other confidential
+data. If you can, don't change the number of words or bytes. It's best
+to change all the letters in passwords and confidential words to 'x'.
+.PP
+That's it. Now you can send an excellent bug report to info@aox.org.
+.SH AUTHOR
+The Archiveopteryx Developers, info@aox.org.
+.SH VERSION
+This man page covers Archiveopteryx version 3.2.0, released 2014-03-10,
+http://archiveopteryx.org/3.2.0
+.SH SEE ALSO
+.BR archiveopteryx (8),
+.BR archiveopteryx.conf (5),
+.BR deliver (8),
+.BR logd (8),
+http://archiveopteryx.org
diff --git b/hung_patch_from_arnt/aox/encodings/utf.cpp a/instrumentation/aox/encodings/utf.cpp
index caf914a..66bf4f2 100644
--- b/hung_patch_from_arnt/aox/encodings/utf.cpp
+++ a/instrumentation/aox/encodings/utf.cpp
@@ -240,8 +240,8 @@ EString Utf16Codec::fromUnicode( const UString & u )
         r.append( 0xff );
     }
     else {
-        r.append( 0xff );
         r.append( 0xfe );
+        r.append( 0xff );
     }
 
     if ( be )
diff --git b/hung_patch_from_arnt/aox/imap/handlers/copy.cpp a/instrumentation/aox/imap/handlers/copy.cpp
index 1882b07..a94ddb7 100644
--- b/hung_patch_from_arnt/aox/imap/handlers/copy.cpp
+++ a/instrumentation/aox/imap/handlers/copy.cpp
@@ -121,8 +121,6 @@ void Copy::execute()
         if ( (uint)r->getInt( "id" ) == d->mailbox->id() ) {
             d->toUid = r->getInt( "uidnext" );
             d->toMs = r->getBigint( "nextmodseq" );
-            if ( session()->mailbox() == d->mailbox )
-                d->fromMs = d->toMs;
         }
         else {
             d->fromMs = r->getBigint( "nextmodseq" );
diff --git b/hung_patch_from_arnt/aox/imap/handlers/fetch.cpp a/instrumentation/aox/imap/handlers/fetch.cpp
index 3ff887a..30e0c82 100644
--- b/hung_patch_from_arnt/aox/imap/handlers/fetch.cpp
+++ a/instrumentation/aox/imap/handlers/fetch.cpp
@@ -154,7 +154,7 @@ Fetch::Fetch( bool u )
     of \\a t.
 */
 
-Fetch::Fetch( bool f, bool a, bool v, const IntegerSet & set,
+Fetch::Fetch( bool f, bool a, const IntegerSet & set,
               int64 limit, IMAP * i, Transaction * t )
     : Command( i ), d( new FetchData )
 {
@@ -166,27 +166,19 @@ Fetch::Fetch( bool f, bool a, bool v, const IntegerSet & set,
     d->set = set;
     d->changedSince = limit;
     d->modseq = i->clientSupports( IMAP::Condstore );
-    d->vanished = v;
     if ( t )
         setTransaction( t->subTransaction( this ) );
 
     d->peek = true;
 
-    Transaction * parent = t;
-    while( parent && parent->parent() )
-        parent = parent->parent();
-
     List<Command>::Iterator c( i->commands() );
     while ( c && c->state() == Command::Retired )
         ++c;
     while ( c && c->tag().isEmpty() )
         ++c;
-    if ( c &&
-         ( ( parent && parent == c->transaction() ) || c->group() > 0 ) &&
-         ( c->state() == Command::Blocked ||
-           c->state() == Command::Finished ||
-           c->state() == Command::Executing ) ) {
-        log( EString("Inserting flag update for modseq>") + fn( limit ) +
+    if ( c && c->group() > 0 && ( c->state() == Command::Finished ||
+                                  c->state() == Command::Executing ) ) {
+        log( "Inserting flag update for modseq>" + fn( limit ) +
              " and UIDs " + set.set() + " before " +
              c->tag() + " " + c->name() );
         i->commands()->insert( c, this );
@@ -200,6 +192,7 @@ Fetch::Fetch( bool f, bool a, bool v, const IntegerSet & set,
     }
 
     setAllowedState( IMAP::Selected );
+    setState( Executing );
 }
 
 
@@ -751,14 +744,12 @@ void Fetch::execute()
                     d->those->setString( s );
                 }
                 enqueue( d->those );
+                d->set.clear();
+                if ( transaction() )
+                    transaction()->execute();
             }
         }
-        if ( transaction() )
-            transaction()->execute();
         if ( d->those ) {
-            if ( !d->those->done() )
-                return;
-            d->set.clear();
             Row * r;
             while ( d->those->hasResults() ) {
                 r = d->those->nextRow();
@@ -775,6 +766,8 @@ void Fetch::execute()
                     d->dynamics.insert( uid, dd );
                 }
             }
+            if ( !d->those->done() )
+                return;
         }
         else {
             IntegerSet r( d->set );
diff --git b/hung_patch_from_arnt/aox/imap/handlers/fetch.h a/instrumentation/aox/imap/handlers/fetch.h
index b749ed5..17351d5 100644
--- b/hung_patch_from_arnt/aox/imap/handlers/fetch.h
+++ a/instrumentation/aox/imap/handlers/fetch.h
@@ -21,7 +21,7 @@ class Fetch
 {
 public:
     Fetch( bool = false );
-    Fetch( bool, bool, bool, const IntegerSet &, int64, IMAP *, Transaction * );
+    Fetch( bool, bool, const IntegerSet &, int64, IMAP *, Transaction * );
 
     void parse();
     void execute();
diff --git b/hung_patch_from_arnt/aox/imap/handlers/select.cpp a/instrumentation/aox/imap/handlers/select.cpp
index b16ac71..376cd78 100644
--- b/hung_patch_from_arnt/aox/imap/handlers/select.cpp
+++ a/instrumentation/aox/imap/handlers/select.cpp
@@ -25,10 +25,11 @@ public:
     SelectData()
         : readOnly( false ), annotate( false ), condstore( false ),
           needFirstUnseen( false ), unicode( false ), qresync( false ),
-          firstUnseen( 0 ), allFlags( 0 ), updated( 0 ),
+          firstUnseen( 0 ), allFlags( 0 ), vanished( 0 ),
           mailbox( 0 ), session( 0 ), permissions( 0 ),
-          cacheFirstUnseen( 0 ),
-          lastUidValidity( 0 ), lastModSeq( 0 ), firstFetch( 0 )
+          cacheFirstUnseen( 0 ), sessionPreloader( 0 ),
+          lastUidValidity( 0 ), lastModSeq( 0 ),
+          firstFetch( 0 )
     {}
 
     bool readOnly;
@@ -39,11 +40,12 @@ public:
     bool qresync;
     Query * firstUnseen;
     Query * allFlags;
-    Query * updated;
+    Query * vanished;
     Mailbox * mailbox;
     ImapSession * session;
     Permissions * permissions;
     Query * cacheFirstUnseen;
+    SessionPreloader * sessionPreloader;
     uint lastUidValidity;
     uint lastModSeq;
     IntegerSet knownUids;
@@ -228,19 +230,52 @@ void Select::execute()
             d->readOnly = true;
     }
 
-    if ( d->lastModSeq < 1 )
-        d->lastModSeq = d->mailbox->nextModSeq() - 1;
-
     if ( !transaction() )
         setTransaction( new Transaction( this ) );
 
     if ( !::firstUnseenCache )
         ::firstUnseenCache = new SelectData::FirstUnseenCache;
 
+    if ( mailboxGroup() && !d->sessionPreloader ) {
+        d->sessionPreloader = new SessionPreloader( mailboxGroup()->contents(),
+                                                    this );
+        d->sessionPreloader->execute();
+
+        IntegerSet s;
+        List<Mailbox>::Iterator i( mailboxGroup()->contents() );
+        while ( i ) {
+            if ( !::firstUnseenCache->find( i, i->nextModSeq() ) )
+                s.add( i->id() );
+            ++i;
+        }
+        if ( s.count() > 2 ) {
+            d->cacheFirstUnseen
+                = new Query( "select min(uid) as uid, mailbox, "
+                             "max(modseq) as modseq "
+                             "from mailbox_messages mm "
+                             "where mailbox=any($1) and not seen "
+                             "group by mailbox", this );
+            d->cacheFirstUnseen->bind( 1, s );
+            transaction()->enqueue( d->cacheFirstUnseen );
+        }
+    }
+    if ( d->sessionPreloader ) {
+        while ( d->cacheFirstUnseen && d->cacheFirstUnseen->hasResults() ) {
+            Row * r = d->cacheFirstUnseen->nextRow();
+            Mailbox * m = Mailbox::find( r->getInt( "mailbox" ) );
+            ::firstUnseenCache->insert( m, 1 + r->getBigint( "modseq" ),
+                                        r->getInt( "uid" ) );
+        }
+        if ( d->cacheFirstUnseen && !d->cacheFirstUnseen->done() )
+            return;
+        if ( !d->sessionPreloader->done() )
+            return;
+    }
+
+
     if ( !d->session ) {
         d->session = new ImapSession( imap(), d->mailbox,
-                                      d->readOnly, d->unicode,
-                                      d->mailbox->nextModSeq() );
+                                      d->readOnly, d->unicode );
         d->session->setPermissions( d->permissions );
         imap()->setSession( d->session );
     }
@@ -256,29 +291,22 @@ void Select::execute()
     else
         d->needFirstUnseen = true;
 
-    if ( d->lastModSeq < d->mailbox->nextModSeq() - 1 && !d->updated ) {
+    if ( d->lastModSeq > 0 && !d->vanished ) {
         if ( d->knownUids.isEmpty() ) {
-            d->updated = new Query( "select uid from deleted_messages "
-                                    "where mailbox=$1 and modseq > $2"
-                                    " union "
-                                    "select uid from mailbox_messages "
-                                    "where mailbox=$1 and modseq > $2",
-                                    this );
+            d->vanished = new Query( "select uid from deleted_messages "
+                                     "where mailbox=$1 and modseq >= $2",
+                                     this );
         }
         else {
-            d->updated = new Query( "select uid from deleted_messages "
-                                    "where mailbox=$1 and modseq > $2 "
-                                    "and uid=any($3)"
-                                    " union "
-                                    "select uid from mailbox_messages "
-                                    "where mailbox=$1 and modseq > $2 "
-                                    "and uid=any($3)",
-                                    this );
-            d->updated->bind( 3, d->knownUids );
+            d->vanished = new Query( "select uid from deleted_messages "
+                                     "where mailbox=$1 and modseq >= $2 "
+                                     "and uid=any($3)",
+                                     this );
+            d->vanished->bind( 3, d->knownUids );
         }
-        d->updated->bind( 1, d->mailbox->id() );
-        d->updated->bind( 2, d->lastModSeq );
-        transaction()->enqueue( d->updated );
+        d->vanished->bind( 1, d->mailbox->id() );
+        d->vanished->bind( 2, d->lastModSeq );
+        transaction()->enqueue( d->vanished );
     }
 
     if ( d->needFirstUnseen && !d->firstUnseen ) {
@@ -292,38 +320,29 @@ void Select::execute()
 
     transaction()->execute();
 
-    if ( ( d->updated && !d->updated->done() ) ||
-         ( d->firstUnseen && !d->firstUnseen->done() ) )
-        return;
-
-    if ( d->updated && !d->firstFetch ) {
-        IntegerSet s;
-        while ( d->updated->hasResults() ) {
-            Row * r = d->updated->nextRow();
-            s.add( r->getInt( "uid" ) );
-        }
-        if ( !s.isEmpty() ) {
-            d->firstFetch = new Fetch( true, false, true,
-                                       s, d->lastModSeq, imap(),
-                                       transaction() );
-            d->firstFetch->setState( Command::Executing );
-            d->session->emitUpdates( transaction() );
-        }
-    }
-    if ( d->firstFetch &&
-         d->firstFetch->state() != Finished &&
-         d->firstFetch->state() != Retired )
-        return;
-
     // emitUpdates often calls Imap::runCommands, which calls this
     // function, which will then change its state to Finished. so
     // check that and don't repeat the last few responses.
-    d->session->emitUpdates( transaction() );
     if ( state() != Executing )
         return;
 
+    d->session->emitUpdates( transaction() );
+
+    if ( d->lastModSeq > 0 && !d->firstFetch ) {
+        if ( d->knownUids.isEmpty() ) {
+            IntegerSet all;
+            all.add( 1, d->mailbox->uidnext() );
+            d->firstFetch = new Fetch( true, false, all,
+                                       d->lastModSeq, imap(), 0 );
+        } else {
+            d->firstFetch = new Fetch( true, false, d->knownUids,
+                                       d->lastModSeq, imap(), 0 );
+        }
+    }
+
     transaction()->commit();
-    if ( transaction()->state() == Transaction::Executing )
+    if ( transaction()->state() == Transaction::Inactive ||
+         transaction()->state() == Transaction::Executing )
         return;
 
     respond( "OK [UIDVALIDITY " + fn( d->session->uidvalidity() ) + "]"
@@ -354,6 +373,17 @@ void Select::execute()
             respond( "OK [ANNOTATIONS READ-ONLY] Missing 'n' right" );
     }
 
+    if ( d->vanished ) {
+        IntegerSet vanished;
+        while ( d->vanished->hasResults() ) {
+            Row * r = d->vanished->nextRow();
+            uint uid = r->getInt( "uid" );
+            vanished.add( uid );
+        }
+        if ( !vanished.isEmpty() )
+            respond( "VANISHED (EARLIER) " + vanished.set() );
+    }
+
     if ( d->session->readOnly() )
         setRespTextCode( "READ-ONLY" );
     else
diff --git b/hung_patch_from_arnt/aox/imap/handlers/store.cpp a/instrumentation/aox/imap/handlers/store.cpp
index 4d0ad01..b70f214 100644
--- b/hung_patch_from_arnt/aox/imap/handlers/store.cpp
+++ a/instrumentation/aox/imap/handlers/store.cpp
@@ -601,10 +601,11 @@ void Store::execute()
         q->bind( 2, m->id() );
         transaction()->enqueue( q );
 
-        if ( d->silent )
-            d->session->ignoreModSeq( d->modseq );
         Mailbox::refreshMailboxes( transaction() );
         transaction()->commit();
+
+        if ( d->silent )
+            d->session->ignoreModSeq( d->modseq );
     }
 
     if ( !transaction()->done() )
diff --git b/hung_patch_from_arnt/aox/imap/imapsession.cpp a/instrumentation/aox/imap/imapsession.cpp
index 3ce295a..568e2d9 100644
--- b/hung_patch_from_arnt/aox/imap/imapsession.cpp
+++ a/instrumentation/aox/imap/imapsession.cpp
@@ -29,6 +29,7 @@ public:
     Log * l;
     IntegerSet expungesReported;
     IntegerSet expungedFetched;
+    IntegerSet changed;
     uint exists;
     uint recent;
     uint uidnext;
@@ -196,14 +197,12 @@ public:
 
 /*! Creates a new ImapSession for the Mailbox \\a m to be accessed
     using \\a imap. If \\a readOnly is true, the session is read-only.
-    If \\a unicode is true, the session presents messages in EAI
-    format, if false, in classic MIME format. If \\a previousModSeq is
-    not zero, then the ImapSession will emit flag updates starting at
-    that modseq.
+    If \\a unicode is true, the session presents messages in EAI format, if
+    false, in classic MIME format.
 */
 
 ImapSession::ImapSession( IMAP * imap, Mailbox * m, bool readOnly,
-                          bool unicode, int64 previousModSeq )
+                          bool unicode )
     : Session( m, readOnly ),
       d( new ImapSessionData )
 {
@@ -211,7 +210,6 @@ ImapSession::ImapSession( IMAP * imap, Mailbox * m, bool readOnly,
     Scope x( imap->log() );
     d->l = new Log;
     d->unicode = unicode;
-    d->cms = previousModSeq;
 }
 
 
@@ -259,6 +257,8 @@ void ImapSession::emitUpdates( Transaction * t )
         }
     }
 
+    emitFlagUpdates( t );
+
     if ( d->uidnext < uidnext() ) {
         if ( !d->existsResponse ) {
             d->existsResponse =
@@ -277,19 +277,20 @@ void ImapSession::emitUpdates( Transaction * t )
         }
     }
 
-    if ( d->nms < nextModSeq() &&
+    if ( imap()->clientSupports( IMAP::Condstore ) &&
+         d->nms < nextModSeq() &&
          !d->highestModseqResponse ) {
         d->highestModseqResponse =
             new ImapSessionData::HighestModseqResponse( this, d );
         work = true;
     }
 
-    emitFlagUpdates( t );
+    if ( d->changed.isEmpty() )
+        d->cms = d->nms;
 
     if ( work )
         d->i->unblockCommands();
     d->i->emitResponses();
-    clearUnannounced();
 
     d->emitting = false;
 }
@@ -303,13 +304,15 @@ void ImapSession::emitFlagUpdates( Transaction * t )
 {
     sendFlagUpdate();
 
-    if ( unannounced().isEmpty() )
+    if ( !d->nms )
+        return;
+    if ( d->cms >= nextModSeq() )
         return;
 
-    if ( d->cms == 0 ) {
-        d->cms = d->nms;
+    d->changed.add( unannounced().intersection( messages() ) );
+
+    if ( d->changed.isEmpty() )
         return;
-    }
 
     List<Command>::Iterator c( d->i->commands() );
     if ( !c || c->state() != Command::Executing )
@@ -338,15 +341,12 @@ void ImapSession::emitFlagUpdates( Transaction * t )
             d->ignorable.clear();
     }
 
-    Fetch * f = new Fetch( true, d->i->clientSupports( IMAP::Annotate ), false,
-                           unannounced().intersection( messages() ),
-                           d->cms - 1, d->i, t );
-    d->cms = d->nms;
-    f->setState( Command::Executing );
+    (void)new Fetch( true, d->i->clientSupports( IMAP::Annotate ),
+                     d->changed, d->cms - 1, d->i, t );
+    d->changed.clear();
 }
 
 
-
 /*! Records that \\a set was fetched while also expunged. If any
     messages in \\a set have already been recorded,
     recordExpungedFetch() summarily closes the IMAP connection.
diff --git b/hung_patch_from_arnt/aox/imap/imapsession.h a/instrumentation/aox/imap/imapsession.h
index cfb402e..c3e465d 100644
--- b/hung_patch_from_arnt/aox/imap/imapsession.h
+++ a/instrumentation/aox/imap/imapsession.h
@@ -18,7 +18,7 @@ class ImapSession
     : public Session
 {
 public:
-    ImapSession( IMAP *, Mailbox *, bool, bool = false, int64 = 0 );
+    ImapSession( IMAP *, Mailbox *, bool, bool = false );
     ~ImapSession();
 
     IMAP * imap() const;
@@ -36,8 +36,6 @@ public:
 
     bool unicode() const;
 
-    void addChangedMessage( uint );
-
 private:
     class ImapSessionData * d;
 
diff --git b/hung_patch_from_arnt/aox/message/mimefields.cpp a/instrumentation/aox/message/mimefields.cpp
index 21fe4ef..6116c9f 100644
--- b/hung_patch_from_arnt/aox/message/mimefields.cpp
+++ a/instrumentation/aox/message/mimefields.cpp
@@ -380,6 +380,10 @@ void ContentType::parse( const EString &s )
                 t = "application";
                 st = "postscript";
             }
+            else if ( s == "postscript" ) {
+                t = "application";
+                st = "postscript";
+            }
             else if ( s == "sgml" ) {
                 t = "text";
                 st = "sgml";
diff --git b/instrumentation/aox/message/tld.inc a/instrumentation/aox/message/tld.inc
new file mode 100644
index 0000000..46d7bc3
--- /dev/null
+++ a/instrumentation/aox/message/tld.inc
@@ -0,0 +1,644 @@
+{ 23, "xn--clchc0ea0b2g2a9gcd." },
+{ 18, "xn--mgberp4a5d4ar." },
+{ 18, "xn--xkc2dl3a5ee0h." },
+{ 17, "xn--xkc2al3hye2a." },
+{ 16, "xn--i1b6b1a6a2e." },
+{ 16, "xn--lgbbat1ad8j." },
+{ 16, "xn--mgba3a4f16a." },
+{ 16, "xn--mgbc0a9azcg." },
+{ 16, "xn--nqv7fs00ema." },
+{ 15, "cancerresearch." },
+{ 15, "xn--6qq986b3xl." },
+{ 15, "xn--fiq228c5hs." },
+{ 15, "xn--mgbaam7a8h." },
+{ 15, "xn--mgbayh7gpa." },
+{ 15, "xn--mgbbh1a71e." },
+{ 15, "xn--mgbx4cd0ab." },
+{ 14, "international." },
+{ 14, "xn--fpcrj9c3d." },
+{ 14, "xn--fzc2c9e2c." },
+{ 14, "xn--yfro4i67o." },
+{ 14, "xn--ygbi2ammx." },
+{ 13, "construction." },
+{ 13, "versicherung." },
+{ 13, "xn--3e0b707e." },
+{ 13, "xn--80adxhks." },
+{ 13, "xn--80asehdb." },
+{ 13, "xn--mgb9awbf." },
+{ 13, "xn--mgbab2bd." },
+{ 13, "xn--ngbc5azd." },
+{ 13, "xn--ogbpf8fl." },
+{ 12, "accountants." },
+{ 12, "blackfriday." },
+{ 12, "contractors." },
+{ 12, "engineering." },
+{ 12, "enterprises." },
+{ 12, "investments." },
+{ 12, "motorcycles." },
+{ 12, "photography." },
+{ 12, "productions." },
+{ 12, "xn--3bst00m." },
+{ 12, "xn--3ds443g." },
+{ 12, "xn--45brj9c." },
+{ 12, "xn--55qw42g." },
+{ 12, "xn--6frz82g." },
+{ 12, "xn--80ao21a." },
+{ 12, "xn--czr694b." },
+{ 12, "xn--d1acj3b." },
+{ 12, "xn--gecrj9c." },
+{ 12, "xn--h2brj9c." },
+{ 12, "xn--j6w193g." },
+{ 12, "xn--kprw13d." },
+{ 12, "xn--kpry57d." },
+{ 12, "xn--pgbs0dh." },
+{ 12, "xn--q9jyb4c." },
+{ 12, "xn--rhqv96g." },
+{ 12, "xn--s9brj9c." },
+{ 12, "xn--ses554g." },
+{ 12, "xn--zfr164b." },
+{ 11, "associates." },
+{ 11, "consulting." },
+{ 11, "creditcard." },
+{ 11, "cuisinella." },
+{ 11, "foundation." },
+{ 11, "immobilien." },
+{ 11, "industries." },
+{ 11, "management." },
+{ 11, "properties." },
+{ 11, "republican." },
+{ 11, "technology." },
+{ 11, "university." },
+{ 11, "vlaanderen." },
+{ 11, "xn--4gbrim." },
+{ 11, "xn--55qx5d." },
+{ 11, "xn--80aswg." },
+{ 11, "xn--90a3ac." },
+{ 11, "xn--cg4bki." },
+{ 11, "xn--czru2d." },
+{ 11, "xn--fiq64b." },
+{ 11, "xn--fiqs8s." },
+{ 11, "xn--fiqz9s." },
+{ 11, "xn--io0a7i." },
+{ 11, "xn--kput3i." },
+{ 11, "xn--o3cw4h." },
+{ 11, "xn--unup4y." },
+{ 11, "xn--wgbh1c." },
+{ 11, "xn--wgbl6a." },
+{ 10, "christmas." },
+{ 10, "community." },
+{ 10, "directory." },
+{ 10, "education." },
+{ 10, "equipment." },
+{ 10, "financial." },
+{ 10, "furniture." },
+{ 10, "institute." },
+{ 10, "marketing." },
+{ 10, "melbourne." },
+{ 10, "solutions." },
+{ 10, "vacations." },
+{ 10, "xn--c1avg." },
+{ 10, "xn--j1amh." },
+{ 10, "xn--l1acc." },
+{ 10, "xn--nqv7f." },
+{ 9, "airforce." },
+{ 9, "attorney." },
+{ 9, "bargains." },
+{ 9, "boutique." },
+{ 9, "brussels." },
+{ 9, "builders." },
+{ 9, "capetown." },
+{ 9, "catering." },
+{ 9, "cleaning." },
+{ 9, "clothing." },
+{ 9, "computer." },
+{ 9, "democrat." },
+{ 9, "diamonds." },
+{ 9, "discount." },
+{ 9, "engineer." },
+{ 9, "exchange." },
+{ 9, "feedback." },
+{ 9, "graphics." },
+{ 9, "holdings." },
+{ 9, "lighting." },
+{ 9, "mortgage." },
+{ 9, "partners." },
+{ 9, "pictures." },
+{ 9, "plumbing." },
+{ 9, "saarland." },
+{ 9, "services." },
+{ 9, "software." },
+{ 9, "supplies." },
+{ 9, "training." },
+{ 9, "ventures." },
+{ 9, "xn--p1ai." },
+{ 9, "yokohama." },
+{ 8, "academy." },
+{ 8, "capital." },
+{ 8, "careers." },
+{ 8, "college." },
+{ 8, "cologne." },
+{ 8, "company." },
+{ 8, "cooking." },
+{ 8, "country." },
+{ 8, "cruises." },
+{ 8, "dentist." },
+{ 8, "digital." },
+{ 8, "domains." },
+{ 8, "exposed." },
+{ 8, "finance." },
+{ 8, "fishing." },
+{ 8, "fitness." },
+{ 8, "flights." },
+{ 8, "florist." },
+{ 8, "frogans." },
+{ 8, "gallery." },
+{ 8, "guitars." },
+{ 8, "hamburg." },
+{ 8, "holiday." },
+{ 8, "kitchen." },
+{ 8, "limited." },
+{ 8, "neustar." },
+{ 8, "okinawa." },
+{ 8, "organic." },
+{ 8, "recipes." },
+{ 8, "rentals." },
+{ 8, "reviews." },
+{ 8, "schmidt." },
+{ 8, "shiksha." },
+{ 8, "singles." },
+{ 8, "support." },
+{ 8, "surgery." },
+{ 8, "systems." },
+{ 8, "website." },
+{ 7, "active." },
+{ 7, "agency." },
+{ 7, "bayern." },
+{ 7, "berlin." },
+{ 7, "camera." },
+{ 7, "career." },
+{ 7, "center." },
+{ 7, "church." },
+{ 7, "claims." },
+{ 7, "clinic." },
+{ 7, "coffee." },
+{ 7, "condos." },
+{ 7, "credit." },
+{ 7, "dating." },
+{ 7, "degree." },
+{ 7, "dental." },
+{ 7, "direct." },
+{ 7, "durban." },
+{ 7, "estate." },
+{ 7, "events." },
+{ 7, "expert." },
+{ 7, "futbol." },
+{ 7, "global." },
+{ 7, "gratis." },
+{ 7, "hiphop." },
+{ 7, "insure." },
+{ 7, "joburg." },
+{ 7, "juegos." },
+{ 7, "kaufen." },
+{ 7, "lawyer." },
+{ 7, "london." },
+{ 7, "luxury." },
+{ 7, "maison." },
+{ 7, "market." },
+{ 7, "monash." },
+{ 7, "moscow." },
+{ 7, "museum." },
+{ 7, "nagoya." },
+{ 7, "photos." },
+{ 7, "physio." },
+{ 7, "quebec." },
+{ 7, "reisen." },
+{ 7, "repair." },
+{ 7, "report." },
+{ 7, "ryukyu." },
+{ 7, "schule." },
+{ 7, "social." },
+{ 7, "supply." },
+{ 7, "suzuki." },
+{ 7, "tattoo." },
+{ 7, "tienda." },
+{ 7, "travel." },
+{ 7, "viajes." },
+{ 7, "villas." },
+{ 7, "vision." },
+{ 7, "voting." },
+{ 7, "voyage." },
+{ 7, "webcam." },
+{ 7, "yachts." },
+{ 6, "actor." },
+{ 6, "archi." },
+{ 6, "audio." },
+{ 6, "autos." },
+{ 6, "black." },
+{ 6, "build." },
+{ 6, "cards." },
+{ 6, "cheap." },
+{ 6, "citic." },
+{ 6, "codes." },
+{ 6, "dance." },
+{ 6, "deals." },
+{ 6, "email." },
+{ 6, "gives." },
+{ 6, "glass." },
+{ 6, "globo." },
+{ 6, "green." },
+{ 6, "gripe." },
+{ 6, "guide." },
+{ 6, "homes." },
+{ 6, "horse." },
+{ 6, "house." },
+{ 6, "jetzt." },
+{ 6, "koeln." },
+{ 6, "lease." },
+{ 6, "loans." },
+{ 6, "lotto." },
+{ 6, "mango." },
+{ 6, "media." },
+{ 6, "miami." },
+{ 6, "ninja." },
+{ 6, "paris." },
+{ 6, "parts." },
+{ 6, "photo." },
+{ 6, "place." },
+{ 6, "press." },
+{ 6, "rehab." },
+{ 6, "reise." },
+{ 6, "rocks." },
+{ 6, "rodeo." },
+{ 6, "shoes." },
+{ 6, "solar." },
+{ 6, "space." },
+{ 6, "tirol." },
+{ 6, "today." },
+{ 6, "tokyo." },
+{ 6, "tools." },
+{ 6, "trade." },
+{ 6, "vegas." },
+{ 6, "vodka." },
+{ 6, "watch." },
+{ 6, "works." },
+{ 5, "aero." },
+{ 5, "army." },
+{ 5, "arpa." },
+{ 5, "asia." },
+{ 5, "beer." },
+{ 5, "best." },
+{ 5, "bike." },
+{ 5, "blue." },
+{ 5, "buzz." },
+{ 5, "camp." },
+{ 5, "care." },
+{ 5, "cash." },
+{ 5, "city." },
+{ 5, "club." },
+{ 5, "cool." },
+{ 5, "coop." },
+{ 5, "desi." },
+{ 5, "fail." },
+{ 5, "farm." },
+{ 5, "fish." },
+{ 5, "fund." },
+{ 5, "gent." },
+{ 5, "gift." },
+{ 5, "guru." },
+{ 5, "haus." },
+{ 5, "host." },
+{ 5, "info." },
+{ 5, "jobs." },
+{ 5, "kiwi." },
+{ 5, "kred." },
+{ 5, "land." },
+{ 5, "life." },
+{ 5, "limo." },
+{ 5, "link." },
+{ 5, "luxe." },
+{ 5, "meet." },
+{ 5, "menu." },
+{ 5, "mini." },
+{ 5, "mobi." },
+{ 5, "moda." },
+{ 5, "name." },
+{ 5, "navy." },
+{ 5, "pics." },
+{ 5, "pink." },
+{ 5, "post." },
+{ 5, "qpon." },
+{ 5, "rest." },
+{ 5, "rich." },
+{ 5, "ruhr." },
+{ 5, "scot." },
+{ 5, "sexy." },
+{ 5, "sohu." },
+{ 5, "surf." },
+{ 5, "tips." },
+{ 5, "town." },
+{ 5, "toys." },
+{ 5, "vote." },
+{ 5, "voto." },
+{ 5, "wang." },
+{ 5, "wien." },
+{ 5, "wiki." },
+{ 5, "zone." },
+{ 4, "axa." },
+{ 4, "bar." },
+{ 4, "bid." },
+{ 4, "bio." },
+{ 4, "biz." },
+{ 4, "bmw." },
+{ 4, "bzh." },
+{ 4, "cab." },
+{ 4, "cat." },
+{ 4, "ceo." },
+{ 4, "com." },
+{ 4, "dnp." },
+{ 4, "edu." },
+{ 4, "eus." },
+{ 4, "foo." },
+{ 4, "gal." },
+{ 4, "gmo." },
+{ 4, "gop." },
+{ 4, "gov." },
+{ 4, "hiv." },
+{ 4, "ink." },
+{ 4, "int." },
+{ 4, "kim." },
+{ 4, "mil." },
+{ 4, "moe." },
+{ 4, "net." },
+{ 4, "nhk." },
+{ 4, "nrw." },
+{ 4, "nyc." },
+{ 4, "onl." },
+{ 4, "org." },
+{ 4, "ovh." },
+{ 4, "pro." },
+{ 4, "pub." },
+{ 4, "red." },
+{ 4, "ren." },
+{ 4, "rio." },
+{ 4, "scb." },
+{ 4, "soy." },
+{ 4, "tax." },
+{ 4, "tel." },
+{ 4, "uno." },
+{ 4, "vet." },
+{ 4, "wed." },
+{ 4, "wtc." },
+{ 4, "wtf." },
+{ 4, "xxx." },
+{ 4, "xyz." },
+{ 3, "ac." },
+{ 3, "ad." },
+{ 3, "ae." },
+{ 3, "af." },
+{ 3, "ag." },
+{ 3, "ai." },
+{ 3, "al." },
+{ 3, "am." },
+{ 3, "an." },
+{ 3, "ao." },
+{ 3, "aq." },
+{ 3, "ar." },
+{ 3, "as." },
+{ 3, "at." },
+{ 3, "au." },
+{ 3, "aw." },
+{ 3, "ax." },
+{ 3, "az." },
+{ 3, "ba." },
+{ 3, "bb." },
+{ 3, "bd." },
+{ 3, "be." },
+{ 3, "bf." },
+{ 3, "bg." },
+{ 3, "bh." },
+{ 3, "bi." },
+{ 3, "bj." },
+{ 3, "bm." },
+{ 3, "bn." },
+{ 3, "bo." },
+{ 3, "br." },
+{ 3, "bs." },
+{ 3, "bt." },
+{ 3, "bv." },
+{ 3, "bw." },
+{ 3, "by." },
+{ 3, "bz." },
+{ 3, "ca." },
+{ 3, "cc." },
+{ 3, "cd." },
+{ 3, "cf." },
+{ 3, "cg." },
+{ 3, "ch." },
+{ 3, "ci." },
+{ 3, "ck." },
+{ 3, "cl." },
+{ 3, "cm." },
+{ 3, "cn." },
+{ 3, "co." },
+{ 3, "cr." },
+{ 3, "cu." },
+{ 3, "cv." },
+{ 3, "cw." },
+{ 3, "cx." },
+{ 3, "cy." },
+{ 3, "cz." },
+{ 3, "de." },
+{ 3, "dj." },
+{ 3, "dk." },
+{ 3, "dm." },
+{ 3, "do." },
+{ 3, "dz." },
+{ 3, "ec." },
+{ 3, "ee." },
+{ 3, "eg." },
+{ 3, "er." },
+{ 3, "es." },
+{ 3, "et." },
+{ 3, "eu." },
+{ 3, "fi." },
+{ 3, "fj." },
+{ 3, "fk." },
+{ 3, "fm." },
+{ 3, "fo." },
+{ 3, "fr." },
+{ 3, "ga." },
+{ 3, "gb." },
+{ 3, "gd." },
+{ 3, "ge." },
+{ 3, "gf." },
+{ 3, "gg." },
+{ 3, "gh." },
+{ 3, "gi." },
+{ 3, "gl." },
+{ 3, "gm." },
+{ 3, "gn." },
+{ 3, "gp." },
+{ 3, "gq." },
+{ 3, "gr." },
+{ 3, "gs." },
+{ 3, "gt." },
+{ 3, "gu." },
+{ 3, "gw." },
+{ 3, "gy." },
+{ 3, "hk." },
+{ 3, "hm." },
+{ 3, "hn." },
+{ 3, "hr." },
+{ 3, "ht." },
+{ 3, "hu." },
+{ 3, "id." },
+{ 3, "ie." },
+{ 3, "il." },
+{ 3, "im." },
+{ 3, "in." },
+{ 3, "io." },
+{ 3, "iq." },
+{ 3, "ir." },
+{ 3, "is." },
+{ 3, "it." },
+{ 3, "je." },
+{ 3, "jm." },
+{ 3, "jo." },
+{ 3, "jp." },
+{ 3, "ke." },
+{ 3, "kg." },
+{ 3, "kh." },
+{ 3, "ki." },
+{ 3, "km." },
+{ 3, "kn." },
+{ 3, "kp." },
+{ 3, "kr." },
+{ 3, "kw." },
+{ 3, "ky." },
+{ 3, "kz." },
+{ 3, "la." },
+{ 3, "lb." },
+{ 3, "lc." },
+{ 3, "li." },
+{ 3, "lk." },
+{ 3, "lr." },
+{ 3, "ls." },
+{ 3, "lt." },
+{ 3, "lu." },
+{ 3, "lv." },
+{ 3, "ly." },
+{ 3, "ma." },
+{ 3, "mc." },
+{ 3, "md." },
+{ 3, "me." },
+{ 3, "mg." },
+{ 3, "mh." },
+{ 3, "mk." },
+{ 3, "ml." },
+{ 3, "mm." },
+{ 3, "mn." },
+{ 3, "mo." },
+{ 3, "mp." },
+{ 3, "mq." },
+{ 3, "mr." },
+{ 3, "ms." },
+{ 3, "mt." },
+{ 3, "mu." },
+{ 3, "mv." },
+{ 3, "mw." },
+{ 3, "mx." },
+{ 3, "my." },
+{ 3, "mz." },
+{ 3, "na." },
+{ 3, "nc." },
+{ 3, "ne." },
+{ 3, "nf." },
+{ 3, "ng." },
+{ 3, "ni." },
+{ 3, "nl." },
+{ 3, "no." },
+{ 3, "np." },
+{ 3, "nr." },
+{ 3, "nu." },
+{ 3, "nz." },
+{ 3, "om." },
+{ 3, "pa." },
+{ 3, "pe." },
+{ 3, "pf." },
+{ 3, "pg." },
+{ 3, "ph." },
+{ 3, "pk." },
+{ 3, "pl." },
+{ 3, "pm." },
+{ 3, "pn." },
+{ 3, "pr." },
+{ 3, "ps." },
+{ 3, "pt." },
+{ 3, "pw." },
+{ 3, "py." },
+{ 3, "qa." },
+{ 3, "re." },
+{ 3, "ro." },
+{ 3, "rs." },
+{ 3, "ru." },
+{ 3, "rw." },
+{ 3, "sa." },
+{ 3, "sb." },
+{ 3, "sc." },
+{ 3, "sd." },
+{ 3, "se." },
+{ 3, "sg." },
+{ 3, "sh." },
+{ 3, "si." },
+{ 3, "sj." },
+{ 3, "sk." },
+{ 3, "sl." },
+{ 3, "sm." },
+{ 3, "sn." },
+{ 3, "so." },
+{ 3, "sr." },
+{ 3, "st." },
+{ 3, "su." },
+{ 3, "sv." },
+{ 3, "sx." },
+{ 3, "sy." },
+{ 3, "sz." },
+{ 3, "tc." },
+{ 3, "td." },
+{ 3, "tf." },
+{ 3, "tg." },
+{ 3, "th." },
+{ 3, "tj." },
+{ 3, "tk." },
+{ 3, "tl." },
+{ 3, "tm." },
+{ 3, "tn." },
+{ 3, "to." },
+{ 3, "tp." },
+{ 3, "tr." },
+{ 3, "tt." },
+{ 3, "tv." },
+{ 3, "tw." },
+{ 3, "tz." },
+{ 3, "ua." },
+{ 3, "ug." },
+{ 3, "uk." },
+{ 3, "us." },
+{ 3, "uy." },
+{ 3, "uz." },
+{ 3, "va." },
+{ 3, "vc." },
+{ 3, "ve." },
+{ 3, "vg." },
+{ 3, "vi." },
+{ 3, "vn." },
+{ 3, "vu." },
+{ 3, "wf." },
+{ 3, "ws." },
+{ 3, "ye." },
+{ 3, "yt." },
+{ 3, "za." },
+{ 3, "zm." },
+{ 3, "zw." },
+{ 1, "." },
+
diff --git b/hung_patch_from_arnt/aox/server/eventloop.cpp a/instrumentation/aox/server/eventloop.cpp
index 6e0953f..c258e9b 100644
--- b/hung_patch_from_arnt/aox/server/eventloop.cpp
+++ a/instrumentation/aox/server/eventloop.cpp
@@ -148,6 +148,7 @@ void EventLoop::addConnection( Connection * c )
 
 void EventLoop::removeConnection( Connection * c )
 {
+    log( "Eventloop::removeConnection called", Log::Error );
     Scope x( d->log );
 
     if ( d->connections.remove( c ) == 0 )
@@ -369,7 +370,7 @@ void EventLoop::start()
                 c->log( "Still have " +
                         EString::humanNumber( c->writeBuffer()->size() ) +
                         " bytes to write", Log::Debug );
-        } catch ( const Exception& e ) {
+        } catch ( Exception e ) {
             // we don't really care at this point, do we?
         }
     }
@@ -501,7 +502,7 @@ void EventLoop::dispatch( Connection * c, bool r, bool w, uint now )
              s && s == c->writeBuffer()->size() )
             c->writeBuffer()->remove( s );
     }
-    catch ( const Exception& e ) {
+    catch ( Exception e ) {
         EString s;
         switch (e) {
         case Invariant:
@@ -557,7 +558,7 @@ void EventLoop::stop( uint s )
             else if ( s <= 1 && !c->hasProperty( Connection::Internal ) ) {
                 c->react( Connection::Shutdown );
             }
-        } catch ( const Exception& e ) {
+        } catch ( Exception e ) {
             removeConnection( c );
         }
     }
diff --git b/hung_patch_from_arnt/aox/server/selector.cpp a/instrumentation/aox/server/selector.cpp
index 7a910e4..1b68a2a 100644
--- b/hung_patch_from_arnt/aox/server/selector.cpp
+++ a/instrumentation/aox/server/selector.cpp
@@ -1721,7 +1721,6 @@ EString Selector::whereNoField()
 {
     if ( d->a == And ) {
         bool f = false;
-        int oldPlaceholder = root()->d->placeholder;
         EStringList conditions;
         List<Selector>::Iterator i( d->children );
         while ( i ) {
@@ -1734,7 +1733,7 @@ EString Selector::whereNoField()
         }
         if ( conditions.isEmpty() )
             return "true";
-        if ( f && oldPlaceholder == root()->d->placeholder )
+        if ( f )
             return "false";
         if ( conditions.count() == 1 )
             return conditions.join( "" );
@@ -1973,13 +1972,10 @@ EString Selector::debugString() const
         break;
     case Age:
         w = "age";
-        break;
     case DatabaseId:
         w = "database-id";
-        break;
     case ThreadId:
         w = "thread-id";
-        break;
     };
 
     r = w + " " + o + " ";
diff --git b/hung_patch_from_arnt/aox/server/server.cpp a/instrumentation/aox/server/server.cpp
index 4cd69ee..b853071 100644
--- b/hung_patch_from_arnt/aox/server/server.cpp
+++ a/instrumentation/aox/server/server.cpp
@@ -207,7 +207,7 @@ void Server::setup( Stage s )
             }
             d->stage = (Stage)(d->stage + 1);
         }
-    } catch ( const Exception& e ) {
+    } catch ( Exception e ) {
         // don't allocate memory or call anything here.
         const char * c = 0;
         switch (e) {
diff --git b/hung_patch_from_arnt/aox/server/session.cpp a/instrumentation/aox/server/session.cpp
index b5f1fab..4c93765 100644
--- b/hung_patch_from_arnt/aox/server/session.cpp
+++ a/instrumentation/aox/server/session.cpp
@@ -8,6 +8,7 @@
 #include "selector.h"
 #include "mailbox.h"
 #include "message.h"
+#include "cache.h"
 #include "event.h"
 #include "query.h"
 #include "scope.h"
@@ -36,9 +37,31 @@ public:
     int64 nextModSeq;
     Permissions * permissions;
     IntegerSet unannounced;
+
+    class CachedData
+        : public Garbage
+    {
+    public:
+        CachedData(): Garbage(), uidnext( 0 ), nextModSeq( 1 ) {}
+        uint uidnext;
+        int64 nextModSeq;
+        IntegerSet msns;
+    };
+
+    class SessionCache
+        : public Cache
+    {
+    public:
+        SessionCache(): Cache( 3 ) {}
+        Map<CachedData> data;
+        void clear() { data.clear(); }
+    };
 };
 
 
+static SessionData::SessionCache * cache = 0;
+
+
 /*! \\class Session session.h
     This class contains all data associated with the single use of a
     Mailbox, such as the number of messages visible, etc. Subclasses
@@ -46,7 +69,7 @@ public:
 */
 
 /*! Creates a new Session for the Mailbox \\a m. If \\a readOnly is
-    true, the session is read-only.
+    true, the session is read-only.  
 */
 
 Session::Session( Mailbox * m, bool readOnly )
@@ -65,6 +88,14 @@ Session::Session( Mailbox * m, bool readOnly )
         d->msns.add( other->d->unannounced );
         d->msns.remove( other->d->expunges );
     }
+    else if ( cache ) {
+        SessionData::CachedData * cd = cache->data.find( m->id() );
+        if ( cd ) {
+            d->uidnext = cd->uidnext;
+            d->nextModSeq = cd->nextModSeq;
+            d->msns.add( cd->msns );
+        }
+    }
     (void)new SessionInitialiser( m, 0, this );
 }
 
@@ -790,3 +821,131 @@ void Session::clearUnannounced()
 void Session::sendFlagUpdate()
 {
 }
+
+
+class SessionPreloaderData
+    : public Garbage
+{
+public:
+    SessionPreloaderData(): owner( 0 ), lock( 0 ), uids( 0 ), done( false ) {}
+
+    List<Mailbox> l;
+    EventHandler * owner;
+    Query * lock;
+    Query * uids;
+    bool done;
+};
+
+
+/*! \\class SessionPreloader session.h
+
+    Loads information about selected mailboxes into the session cache,
+    so that newly-created sessions have access to it straightaway.
+*/
+
+/*!  Constructs a SessionPreloader which will preload the session cache
+     with information about \\a mailboxes, and then notify \\a handler.
+
+     If the cache already contains all that information, then
+     execute() will set done() and not call \\a handler.
+*/
+
+SessionPreloader::SessionPreloader( List<Mailbox> * mailboxes,
+                                  EventHandler * handler )
+    : d( new SessionPreloaderData )
+{
+    List<Mailbox>::Iterator i( mailboxes );
+    while ( i ) {
+        d->l.append( i );
+        ++i;
+    }
+    d->owner = handler;
+}
+
+
+void SessionPreloader::execute()
+{
+    if ( !::cache )
+        ::cache = new SessionData::SessionCache;
+
+    if ( !d->uids ) {
+        IntegerSet e;
+        IntegerSet a;
+        IntegerSet s;
+        List<Mailbox>::Iterator i( d->l );
+        while ( i ) {
+            if ( i->uidnext() <= 1 )
+                e.add( i->id() );
+            else if ( ::cache->data.find( i->id() ) )
+                a.add( i->id() );
+            else
+                s.add( i->id() );
+            ++i;
+        }
+        if ( s.count() > 2 ) {
+            log( "Session preloader: " +
+                 fn( a.count() ) + " already cached, " +
+                 fn( e.count() ) + " mailboxes empty, " +
+                 fn( s.count() ) + " can be preloaded." );
+            Transaction * t = new Transaction( this );
+            d->lock
+                = new Query( "select id, uidnext, nextmodseq, first_recent "
+                             "from mailboxes where id=any($1) "
+                             "order by id for update", 0 );
+            d->lock->bind( 1, s );
+            t->enqueue( d->lock );
+            d->uids = new Query( "select mailbox, uid from mailbox_messages "
+                                 "where mailbox=any($1)", this );
+            d->uids->bind( 1, s );
+            t->enqueue( d->uids );
+            t->commit();
+        }
+        else {
+            // for just 0-2 mailboxes this query won't be a net gain
+            d->done = true;
+        }
+    }
+
+    if ( !d->uids || !d->uids->done() )
+        return;
+
+    while ( d->lock->hasResults() ) {
+        Row * r = d->lock->nextRow();
+
+        SessionData::CachedData * cd = ::cache->data.find( r->getInt( "id" ) );
+        if ( !cd ) {
+            cd = new SessionData::CachedData;
+            ::cache->data.insert( r->getInt( "id" ), cd );
+        }
+
+        cd->uidnext = r->getInt( "uidnext" );
+        cd->nextModSeq = r->getBigint( "nextmodseq" );
+
+        // if there are recent messages the next SI has to look, so
+        // force it. sigh. recent is such a mess.
+        if ( cd->uidnext > (uint)r->getInt( "first_recent" ) )
+            cd->nextModSeq--;
+    }
+
+    while ( d->uids->hasResults() ) {
+        Row * r = d->uids->nextRow();
+        SessionData::CachedData * cd =
+            ::cache->data.find( r->getInt( "mailbox" ) );
+        if ( cd )
+            cd->msns.add( r->getInt( "uid" ) );
+    }
+
+    d->done = true;
+    d->owner->notify();
+}
+
+
+/*! Returns true if the SessionPreloader has done all it's going to do,
+    and false if it hasn't.
+
+*/
+
+bool SessionPreloader::done()
+{
+    return d->done;
+}
diff --git b/hung_patch_from_arnt/aox/server/session.h a/instrumentation/aox/server/session.h
index d5577b4..90440ef 100644
--- b/hung_patch_from_arnt/aox/server/session.h
+++ a/instrumentation/aox/server/session.h
@@ -99,4 +99,18 @@ private:
 };
 
 
+class SessionPreloader
+    : public EventHandler
+{
+public:
+    SessionPreloader( List<Mailbox> *, EventHandler * );
+
+    void execute();
+    bool done();
+
+private:
+    class SessionPreloaderData * d;
+};
+
+
 #endif
diff --git b/hung_patch_from_arnt/aox/server/timer.cpp a/instrumentation/aox/server/timer.cpp
index 42007bb..f30a381 100644
--- b/hung_patch_from_arnt/aox/server/timer.cpp
+++ a/instrumentation/aox/server/timer.cpp
@@ -135,7 +135,7 @@ void Timer::notify()
     try {
         d->owner->execute();
     }
-    catch ( const Exception& e ) {
+    catch ( Exception e ) {
         d->owner = 0; // so we can't get close to a segfault again
         if ( e == Invariant ) {
             // Analogous to EventLoop::dispatch, we try to close the
@@ -161,7 +161,7 @@ void Timer::notify()
             }
         }
         else {
-            throw;
+            throw e;
         }
     }
 }
diff --git b/hung_patch_from_arnt/aox/server/tlsthread.cpp a/instrumentation/aox/server/tlsthread.cpp
index e25ed6b..cb9e73d 100644
--- b/hung_patch_from_arnt/aox/server/tlsthread.cpp
+++ a/instrumentation/aox/server/tlsthread.cpp
@@ -93,14 +93,14 @@ void TlsThread::setup()
     SSL_library_init();
 
     ctx = ::SSL_CTX_new( SSLv23_server_method() );
-    long options = SSL_OP_ALL
-        // also try to pick the same ciphers suites more often
-        | SSL_OP_CIPHER_SERVER_PREFERENCE
-        // and don't use SSLv2, even if the client wants to
-        | SSL_OP_NO_SSLv2
-        // and not v3 either
-        | SSL_OP_NO_SSLv3
-        ;
+    int options = SSL_OP_ALL
+                  // also try to pick the same ciphers suites more often
+                  | SSL_OP_CIPHER_SERVER_PREFERENCE
+                  // and don't use SSLv2, even if the client wants to
+                  | SSL_OP_NO_SSLv2
+                  // and not v3 either
+                  | SSL_OP_NO_SSLv3
+                  ;
     SSL_CTX_set_options( ctx, options );
 
     SSL_CTX_set_cipher_list( ctx, "kEDH:HIGH:!aNULL:!MD5" );
[
