Production of detergents