Moved imap logic into source, added search term to source