add history cleanup and unused items data cleanup