Refactor js

Rewriting our js to be more readable and less hacky.


All ui strings should be stored elsewhere for easy editing. Potential i18n use in the future that way as well.