This seems like something we could use in core...