Reduce usage of shared_ptr