I don't totally get what this is supposed to be doing. Maybe add a doctest to show what it's doing?