Added variable historyCount