shared_ptr -> const shared_ptr& for a few instances, accidental pass by value