Fixed bugs in flood fill implementation.
Added many unit tests for flood fill routine.