Changed std::vectors to std::list to improve efficiency