Switch to use references, not pointers
Fix to reference update