Fix clean function to allow for diverse input