Code for ViewNode class