Improved handling of duplicates and prevent messages from disappearing