swapped node ptrs to refs in some funcs