A better solution for 457cadc47. Still hackish, but at least it's concentrated in single place now.