replacing raw pointers by smart pointers