binary tree logic added