Avoid unneeded copies by using const references and `std::move` where possible. + Changes suggested by clang-tidy