script: Make trees less generic

r? @metajack