added explanatory comments to chain.py