Refactor: Localize variables
Refactor: Replace history handle with std::vector<HISTORY>