added a data cleaning function