Move floodfill to library
Add using library mode