Redefined smart pointer classes in safer way