Added dict2tree method