refactor: reduced some clones (#15413)