refactored jscript and bundled actions under named variable functions