Related: #1565
I didn't manage to actually fix the issue, but I wanted this refactoring to be in there.