Hm, that's obviously a hack, although I don't know what's better. In theory, what's the right way to do this?