Refactoring for blog post. Adding comments to code.