made better fix of local storage javascript but it is still requires better cohesion