added numberOfOccurrences and refactored isTreeBalanced