Further abstract patch context finding, to parallel context
generation.  Extract array helpers.  Add more jsdoc.