move to shared_ptr usage instead of hand-rolled refcnt.