Replacing some raw pointers by smart pointers
Adding documentation