Improved code and added localStorage feature

* Improved the code to higher up the standard.
* Added new localStorage feature
*

*