some progress on static tree building but I think this needs to be abandoned