Change raw pointer to smart pointer