refactor add_on_empty and normalize_message