addd HistoryManager and moved basic functionalit there