JS tidying