Replaced all pointers by shared_ptr.