Improved reference-counted pointer