Add caching capability to Chain and rename a couple of functions.