updated js - ensure the variable are not global