General structure of operation and MBOX writing.

So far, only unit test for the latter.