I think this works S/O @berwyn