This works with shared pointers