Added code to transform tree to backbone. Todo: add balancing code.