Update to use smart pointers