Added support for `root` option (to specify when stop traversal); minor fixes.