This is why I see ChatGPT being an excellent helper but NOT a replacement. This code is also very generic. I will have to manually tweak some stuff for my specific use case. Still, it took 95% of the work off my hands.