massive reafactoring of mail archive

+ minor small changes (as usual)