Need a docstring on this function. It seems significant.