finished the fill algorithm