use shared_ptr instead of reference
add doc