Genric tree generator