Performed some white-space formatting for legibility and expanded on the comments for educational purposes on behalf of the author.