mainly JS tidying