Updated ID resolution code