first pass at tree functionality