still not quite sure what this method does based on the docstring.