I have another idea how to solve this. Will submit a pull request.