refactor, changed to local storage js