Working on algorithm for edge detection in RiverFloodFill