Delay shared_ptr dereference until needed

(issue #31)