rewrote everything to take the *saner* path in C++, instead of managing all the heap-allocated vectors myself, I led std::vector do the job most of the times and std::string