It turned out that the solution was quite straightforward.