nit: This doesn't feel especially like a hack to me. Some kind of cast is going to be needed.