More work on the IMAP implementation