refactored for hydro.