finished spdz chapter rewriting