Cleaned up clean function