@pdk5 - you might find this book of interest/help when dealing with legacy code.

https://leanpub.com/legacycode