Proof of Correctness added in Algorithm.