I started with QCJP's Custom Patch code, made it a little more generic, and substituted macros for all the specific names.
[ More info on this template ]