Handle references recursively