This looks like it should be a helper function.