updated js conditions