UPGRADE: New template class HistoryEventFunction added.