Change node to a struct. Improved reference counting.