Thinking about it again: This and the previous one can be combined. (That was not the case in an earlier iteration of my code).