 haystack.indexOf(needle), depth = 0, x;
            for (x = idx - 1; x >= 0; x--) {
                switch (haystack.charAt(x)) {
                    case '<':
                        depth--;
                        break;
                    case '>':
                        depth++;
                        break;
                    case '&':
                        depth++;
                        break;
                }
            }
            return depth;
        }

        // This function is c