add refactoring for peer service and localstorage for history