Changed pointer types to managed shared_ptr