Minor tidying of JS