Reformmated the code by moving the javascript to its own file and then importing on HTML.  Then cleaned up the js code.