tightened up implementation of fill_line