Further JS tidying up