PL5_ex6 error correction and program restructuring