Worked on the IMAP code a bit more