[improvement] use smart pointers instead raw pointers