updated floodfill to use pointers