dvanceMode' MaildirMode =  do
  st <- get
  unsortedEmails <- liftIO $ do
    freeOldHandlers st
    let md = (selectedMD . maildirState) $ st
    emails <- getMaildirEmails md
    mapM toEmail emails
  let selectedEmails' = reverse $ sort unsortedEmails
  let scrollRow = scrollRowIn . indexState $ st
  let scrRows = screenRows st
  let indexState' = (indexState st) {
          selectedEmails = selectedEmails'
        , currentInLen   = length selectedEmails'
        , scrollBufferIn = formatIndexModeRows st $ scrollCrop scrollRow scrRows selectedEmails'
        }
  put $ st { mode = IndexMode, indexState = indexState' }

  where
    toEmail fp = do
      handle <- openFile fp ReadMode
      msg <- UTF8.hGetContents handle
      let value = parseMIMEMessage msg
      let headers = mime_val_headers value
      let date = maybe startOfTime id $ parseDateTime rfc822DateFormat $ takeWhile (/= '(') $ lookupField "date" headers
      return (Email value date fp handle)

advanceMode' MaildirMode =  do
  st <- get
  unsortedEmails <- liftIO $ do
    freeOldHandlers st
    let md = (selectedMD . maildirState) $ st
    emails <- getMaildirEmails md
    mapM toEmail emails
  let selectedEmails' = reverse $ sort unsortedEmails
  let scrollRow = scrollRowIn . indexState $ st
  let scrRows = screenRows st
  let indexState' = (indexState st) {
          selectedEmails = selectedEmails'
        , currentInLen   = length selectedEmails'
        , scrollBufferIn = formatIndexModeRows st $ scrollCrop scrollRow scrRows selectedEmails'
        }
  put $ st { mode = IndexMode, indexState = indexState' }

  where
    toEmail fp = do
      handle <- openFile fp ReadMode
      msg <- UTF8.hGetContents handle
      let value = parseMIMEMessage msg
      let headers = mime_val_headers value
      let date = maybe startOfTime id $ parseDateTime rfc822DateFormat $ takeWhile (/= '(') $ lookupField "date" headers
      return (Email value date fp handle)
advanceMode' MaildirMode =  do
  st <- get
  unsortedEmails <- liftIO $ do
    freeOldHandlers st
    let md = (selectedMD . maildirState) $ st
    emails <- getMaildirEmails md
    mapM toEmail emails
  let selectedEmails' = reverse $ sort unsortedEmails
  let scrollRow = scrollRowIn . indexState $ st
  let scrRows = screenRows st
  let indexState' = (indexState st) {
          selectedEmails = selectedEmails'
        , currentInLen   = length selectedEmails'
        , scrollBufferIn = formatIndexModeRows st $ scrollCrop scrollRow scrRows selectedEmails'
        }
  put $ st { mode = IndexMode, indexState = indexState' }

  where
    toEmail fp = do
      handle <- openFile fp ReadMode
      msg <- UTF8.hGetContents handle
      let value = parseMIMEMessage msg
      let headers = mime_val_headers value
      let date = maybe startOfTime id $ parseDateTime rfc822DateFormat $ takeWhile (/= '(') $ lookupField "date" headers
      return (Email value date fp handle)