all references to `.with_ref' have been replaced with .as_ptr()