moved some calls to a api file for clearer code in the js files connected to the html files.