- Text display was broken due to referring to 'text' instead of 'newText'.
- Replaced 'var' with 'const'/'let' everywhere that made sense to. - Removed some duplicate code and tidied up a few functions. - Marked private functions with leading underscore. - Documentation and formatting improvements.