change some data structure from c linked list to std c++ containers