tidied up the js