Added a few more comments to template code, trying to explain it more.