Refactored 'seen messages' mechanism.