Adding two phase commit algorithm