TreeDict now working properly with original code.