Make code clearer and add support for mboxes