Reference Grounding Algorithm