some cleanup
better handling of newnode