WIP - references now working too, it seems