tidying up the JS