Clean script
Worked on saving HistoryItem to DB, not working yet.