Implemented linked node destruction using smart pointers