added JS functions