Fixed the issue with traversing the tree and checking out if the getInstance method is used twice under the same class.