refactor duplicate message