imap cmd generation prototype
start refactor