I reorganized the flood fill function. It works better, but still not nearly good enough