added usage of smart pointers