extended level flood fill function for variable array sizes