I have a better version available in another project. I'll port it over.