Refactor functions and edit html

* Refactor functions
* Improve function names
* Edit copy in html