generalizing imap