Co-authored-by: Tim Givois <tim.givois.mendez@gmail.com>
Thanks Florian Apolloner for contributing to this patch and Collin Anderson, Markus Holtermann, and Tim Graham for review.