creating generic tree traversal classes