Better Documented Version of the Code