Factors leading to the Confederate surrender