Added a docstring. Changed function to output a list of dictionaries for ease of processing.