CC: Oleg Pykhalov who seems to have worked on this. Thanks, pukkamustard