First try at reference resolving (WIP)