Refactoring of imap.fetch usage