starting to restructure some of the javascript code for the web frontend