updated main for duplicate message reading