finish the fill algorithm