If you have any other (better?) ways of doing this, feel free to add some comments on the issue tracker.