o Temporary shared pointers created to hold upcast argument values now share ownership with the original pointer.
o New test cases for edge cases.
o Other minor clean-up.