implemented tree structure creations and fixed bug