I never thought I could actually use a floodfill algorithm some time.