Changed water detection to return the masked image data and other changes