All of mjm159's code in one PR of death