Refactor the metadata proxy a bit.