function update(bytes code) permissionRequired("update",""){
	    address addr;
        assembly {
            addr := create(0,add(code,0x20), mload(code))
            jumpi(invalidJumpLabel,iszero(extcodesize(addr)))
        }
        addr.call.gas(msg.gas)(bytes4(sha3("tellPreviousContract(address)")),currentContract);
        currentContract = addr;
        for (uint x=0;x<contractArray.length-1;x++) {
            contractArray[x].call.gas(msg.gas)(bytes4(sha3("changeMain(address)")),currentContract);
        }
	}