function to clean data