updated tree traversal and class hierarchy a little
fixed comments