Improved river logic: made smarter checks to end adjacent to water and to prevent rivers spreading diagonally