Separate floodfill algorithm