Changed node function to push function. It now correctly shifts an element from the array to the reference.