1. Are there still categories left?
    1. Yes
      1. Is this the lft anchor?
        1. Yes
          1. If lft anchor == 1
          2. Yes
          3. Valid
          4. Init Variables
          5. No
          6. Invalid!
          7. Add info to corrections array
          8. Init Variables
          9. If rgt anchor == count(categories) * 2
          10. Yes
          11. Valid
          12. Init Variables
          13. No
          14. Invalid!
          15. Add info to corrections array
          16. Init Variables
        2. No
          1. Is this a child node?
          2. Yes
          3. This is a child
          4. If index >= lft
          5. Yes
          6. Invalid!
          7. lft = index + 1
          8. rgt = index + 2
          9. No
          10. while index < lft
          11. If lft == index + 1
          12. Yes
          13. If rgt == index + 2
          14. Yes
          15. Valid
          16. index += 2
          17. No
          18. Invalid!
          19. Add info to corrections array
          20. index += 2
          21. No
          22. If empty(stack)
          23. Yes
          24. Invalid!
          25. Add info to corrections array
          26. lft = index + 1
          27. No
          28. If end(stack) == index + 1
          29. Yes
          30. Valid
          31. Pop rgt off of stack
          32. index++
          33. No
          34. Invalid!
          35. Add info to corrections array
          36. lft = index + 1
          37. No
          38. This is a parent
          39. If index >= lft
          40. Yes
          41. Invalid!
          42. lft = index + 1
          43. No
          44. while index < lft
          45. If lft == index + 1
          46. Yes
          47. Push rgt onto stack
          48. index++
          49. No
          50. If empty(stack)
          51. Yes
          52. Invalid!
          53. Add info to corrections array
          54. lft = index + 1
          55. No
          56. If end(stack) == index + 1
          57. Yes
          58. Valid
          59. Pop rgt off of stack
          60. index++
          61. No
          62. Invalid!
          63. Add info to corrections array
          64. lft = index + 1
    2. No
      1. While index < end
        1. If index == end - 1
          1. Yes
          2. End!
          3. No
          4. If empty(stack)
          5. Yes
          6. Invalid!
          7. Add info to corrections array
          8. index++
          9. No
          10. If end(stack) == index + 1
          11. Yes
          12. Valid
          13. Pop rgt off of stack
          14. index++
          15. No
          16. Invalid!
          17. Pop rgt off of stack
          18. Add info to corrections array
          19. index++