This is a very neat way of doing it! I've committed it.