 I'm currently working on something else and I don't have the time to make a PR to improve this, but it could definitely be worth having a look at.