change to use smart pointer