Function to clean raw data
Adds docstring and fixes extra-line bug