started cleaning up the javascript