Your problem is that you're trying to use a data structure for a purpose it wasn't designed to handle. Transform the structure first, then manipulate it. Much saner.
Plus, it's Afrikaans, not Africans.
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?