We extend the work of Hull and White and Kettunen and Meissner and build a credit default swap (CDS) pricing model that includes default intensities and default correlation of all three involved entities, ie, the investor (the CDS buyer), the counterparty (the CDS seller) and the underlying reference entity. We build the model in a discrete time frame, so that the user can match the timing of CDS spread payments exactly and alter cashflows if desired. We combine two octuple trees and use swap evaluation techniques to derive a closed-form solution for the CDS spread including default corrrelation of all three entities. We find that the default intensity of the investor has a strong impact on the CDS spread, whereas the default correlation of the investor with other CDS entities has a minor impact. The Matlab source code of the model is provided upon request.