I made something similar, but for code review: https://imgur.com/CKv75vb
Based on my previous manual experiments: https://imgur.com/a/ZRg5x7t
But I haven't shipped it yet, hope to be done by Christmas