KRACOEUS-7197

And I think we can reuse more of this code instead of duplicating it all.