tree impl made generic