Flag function rewritten and possibility of limiting the number of messages imported from each mailbox