Converted into a proper package, rather than an ad-hoc script.