Refactored out into several methods/relocated variables, used namedtuples for convenience.  Fixed line numbering error with no hunk info