Flood Fill Optimization

Fixed boundary issues and vastly improved the performance of flood fill.