Removed a malloc that had no free (so would leak memory if called in a loop)
Continuing to try and simplify and remove manual memory alloctations... getting a little hairy... seems necessary though if we want to call this function in a loop without running out of memory
I can hardly believe that this still compiles and runs correctly, but the counts continue to match the prior run!  Maybe I'll even half understand what this code is doing soon...
Removed more manual memory allocations
Removed unused string which was also leaking memory
Removed another unused string
using gcc instead of clang