add js to deal with increment or initial final mode