I saw that we have to duplicate code in there, which I thought would fit into such a function.