Trying to change the raw pointers to smart pointers