added smart pointer implementation