implemented a smart pointer design