xrt: Improve the xrt_reference helper functions, making them more clear and better documented.