Added a few comments to clarify certain parts of code.