Some smart pointers refactoring.