revised code at mark unread messages as read