Switching all the pointers to smart pointers in order to avoid dangling references and automatic release of resources