Address minor coverity defects: Excessive stack allocation, and use std::move where possible instead of copy.