add some formatting and comments to the code