Removed several delete statements from the code in favor of std::vector