I have the following JavaScript functions which are linked to a HTML file, as they are called by a recordHistory() button in the HTML file. The JavaScript work well functionally