js tidying up