Reformatting and refactoring imap_parser.