Clean up catch_pointer_reference, and add more comments