finishing tree api and working in new output api