Fix bug in depth-first search that would cause an exception when hitting the first leaf node.
Start to update documentation to include variables and derivations.