Updated the solvent detection algorithm