Cleaning the Code, and Commenting

I cleaned the code for wrong things and added a few new comments in the
code.
It should now be easy to understand. It is much more commented, as
needed.