add equals method to Node
fixed unnecessary call to nodes