finally have tree path algorithm working; generate branches also works