Remove unnecessary whitespace, write generator method, and add docstring to generator method