update
modified to test for different node types
more work on autodetecting node type