implemented flood filling (breadth first)