Switching from raw pointers to smart pointers